the Fatwa Department Research Committee - chaired by Sheikh `Abd al-Wahhâb al-Turayrî
Cochineal (often referred to as red #2) is indeed derived from the beetle Dactylopius coccus and is used as a colorant in a wide range of food products. The pigmentation collected from the insect is a bitter, astringent chemical, deep crimson in color, called carminic acid.
There is disagreement among the scholars on the ruling of eating insects. It is permissible according to Mâlikî school of thought as well as according to the view of the leading jurists Ibn Abî Laylâ and al-Awzâ`î. While the majority – including the Hanafî, Shâfi`î and Hanbalî scholars – have ruled that eating insects is impermissible.
In consideration of this disagreement, and in consideration of the general widespread distribution of this colorant in the foods available in today’s marketplace and the difficulty that avoiding such products would cause (the principle of `umûm al-balwâ in Islamic Law), and in consideration of the fact that a relatively small amount of this substance is used in a given food product (the usage of this coloring according to the food industry standard is not more than 0.003% - 0.006%), we would say that it is permitted to consume food products that contain this ingredient.
And Allah knows best.
Source: Islam Today