How does bleach work?

There are many kinds of bleach. Each of them work in slightly different ways to do the same thing: change a molecule that absorbs visible light into a molecule that does not.

If we look at a molecule of cyanidin (an anthocyanin dye molecule that give flowers their color), we can see the pattern of alternating double and single bonds that allow the molecule to absorb visible light.

Cyanidin

The electrons in these bonds are actually shared (delocalized) across all of the atoms in the rings, which is why they can slosh around the molecule like water in a bathtub. When they slosh at the same frequency as visible light, they can absorb it.

Chlorine bleach and hydrogen peroxide both provide oxygen atoms that can combine with the molecule to change the loops so they no longer have delocalized electrons to slosh around.

Quercetin

Quercetin is a molecule where oxygen atoms have been added to cyanidin. The ring in the middle no longer has delocalized electrons, and the molecule is colorless.

Other chemicals can also bleach dye molecules such as cyanidin. Sulfur dioxide and sulfites can add SO2 groups to the molecule that also steal electrons from the center ring, causing the molecule to become colorless.