This question was originally posed to me on Reddit, but since many of you have written in asking about it I am reproducing it here.
tl;dr: Cochineal is ok eat according to the broadest reading of religious texts and the majority of religious scholars, while some would disagree about its permissibility.
Here are the details:
In dealing with this issue, there are two preliminary questions we have to deal with:
1- What is the ruling on eating insects?
2- Does the extraction and change of a substance from a doubtful source make it allowed?
The majority of scholars from the 4 schools did not allow eating insects, while the Malikis did. The Maliki position states that “Say: I find nothing in what was revealed to me as forbidden for one to eat except carrion…” to the end of the verse. (Quran 6:145) Since bugs aren’t named here, they are allowed.
So for someone taking this position, #2 doesn’t even have to be answered.
For the other 3 schools, while they may not allowed the direct ingestion of an insect because to them it is impermissible to ingest things that are repulsive (yes, I know this is subjective, we’re not debating their position, just trying to understand it, stick with me) they will still be split as to whether or not cochineal is permitted.
While all Jurists agree that if wine turns to vinegar it is permitted to consume and is now considered pure (Tahir) they still differ about other than wine. Hanafis, some Hanbalis, some Malikis, and the Zahiris all agree that if something impure is changed into something pure so much so that it no longer distinguishable as the original substance (basically a change at a molecular level) then it will be considered pure. Shafi’s and Hanbalis do not agree.
So the conclusion is that Cochineal is OK eat according to the broadest reading of religious texts and the majority of religious scholars, while some would disagree about its permissibility.