Why does a lobster turn red when cooked?

The red pigment is the most stable component of the coloring in a lobster shell. The greens and browns which darken the shell in a live lobster are destroyed by cooking.