This question seems to be tricky even for native speakers. I have done a quick search on Google and gotten mixed results. However, the best result I have gotten so far is from iTalki.com:
They are pretty much synonyms. I see that m-w.com lists each as a synonym for the other.
TO ME, "excerpt" SUGGESTS a long passage that is intended to be read, possibly for enjoyment, as a coherent whole. An example would be an entire book chapter--for example, a whole chapter of a new book published in a magazine.
TO ME, an "extract" is usually shorter than an "excerpt" but longer than a "quotation."
The sense I am interested in is when used to deal with text whether it is a book, essay, transcript, poem etc.
Some criteria you could think about giving the best answer is:
Length (which one is longer in general)
Collocations (I really want to know if there is, and hopefully get some examples)
Register (academic, governmental, legal, entertainment and spoken English)