Look closely at the ingredients listed on the back of your M&Ms package and you're sure to see Blue No. 2 there. Those versed in the chemistry of colorants will realize that's the same chemical that's in your blue jeans: indigotine.

We now know that natural red dye comes from bugs, but what's the story behind all the blue food we put into our mouths?

The U.S. Food and Drug Administration (FDA) has approved seven artificial colorings for food, including two blues: Blue No. 1 and Blue No. 2—which are often combined in food products like M&Ms.

Blue No. 1 is called "brilliant blue" and, as is typical of modern dyes, was originally derived from coal tar, although most manufacturers now make it from an oil base. Blue No. 2, or "indigotine," on the other hand, is a synthetic version of the plant-based indigo that has a long history as a textile dye.

Although toxicology studies have demonstrated that both of these dyes are relatively safe, the Center for Science in the Public Interest (CSPI) and other advocacy organizations have long argued that these and other artificial colorings may be linked to attention deficit disorder (ADD). In September 2007, a study in the U.K. medical journal The Lancet came to a similar conclusion, leading the European Parliament last July to order such products to carry a label warning consumers of the potential risk. Such concerns are behind the decision by the Nestlé–Rowntree candy company in England to pull its blue Smarties—an M&M look-alike—from shelves in 2005. In February 2008, the company brought them back, using spirulina, a bluish mixture of two species of cyanobacteria, in lieu of the chemicals.

To find out more about the origins of blue food colorants used today, we spoke with Hamish McNab, a chemist at the University of Edinburgh in Scotland who specializes in the heterocyclic compounds used to produce a range of dyes.

[An edited transcript of the interview follows.]

What are the natural sources of blue dye?

Indigo, which comes from the indigo plant (Indigofera), has been used for probably at least 4,000 years. There is a written recipe for dying wool with indigo on a Babylonian cuneiform tablet dated to the seventh century B.C. There is evidence that it was used in neolithic Europe and in pharaonic Egypt. It also comes from the woad plant (Isatis tinctoria), and was used by the Celts in Scotland to dye their faces.

If you speak to experts in the dying industry, they will tell you indigo is not colorfast: It washes out, fades rather rapidly—more rapidly than a designed synthetic dye. For the past 30 or 40 years faded jeans have been the uniform of students, and when I lecture I can be sure that at least half out of 100 undergraduates will be wearing indigo.

Indigo appears to be licensed for use as a food dye in the U.S., but most [food dyes] are synthetic and of broadly similar chemical constitution to those used as textile dyes.

Also, there are shellfish dyes, which are purple. They are quite interesting, because in Roman times there was a penalty of death if somebody outside the ruling elite was seen using these purple dyes. They had to use masses of these shellfish—hundreds of thousands of shellfish—to dye a relatively small piece of cloth.

When did people start synthesizing blue dye?

Up until about the middle of the 19th century all of the colorings were natural coloring. Then William Perkin [an English chemist] came along and made his mauve. That was a color you couldn't get naturally and it took the world by a storm. It was the first synthetic dyestuff to really take off.

The chemical constitution of indigo was worked out by Adolf von Baeyer in 1883. The first commercial synthesis was achieved in 1897 and was improved in 1901.

Do you think it's dangerous to eat blue food dye?

My own view is that any chemical should be regarded as potentially harmful when ingested. Note that naturally occurring chemicals can be just as harmful as synthetic ones—strychnine is no less poisonous because it occurs naturally!