We love the sun. We complain about rainy days, we look forward to summers at the beach. But we hate sunburns, wrinkled skin, and melanomas. All of those nasty things are the result of the ultraviolet that comes with the warmth and light of sunshine.
There are a large number of chemicals used to block ultraviolet light, either to protect the user's skin, or to protect a product from being damaged (colors fading, scents decomposing, etc.)
There are two ways to protect the skin from ultraviolet light -- absorb the light, or reflect the light. Zinc oxide and titanium oxide reflect, or scatter light of many frequencies, from infrared through ultraviolet. That is why they appear opaque white.
When you don't want to paint yourself white, you can paint yourself with a color that absorbs ultraviolet, but is transparent to visible light.
Ultraviolet light is often divided into two types, UV-A, which has a longer wavelength (320-360nm) and UV-B, which has a shorter wavelength (280-320nm). Shorter wavelengths mean higher energies. UV-B is more damaging than UV-A. Some UV blockers are optimized to block the shorter wavelengths, while letting the longer wavelengths get through. SPF numbers (sun protection factor) only describe UV-B protection. A high SPF can still let UV-A through. UV-C is the shortest wavelength of ultraviolet light, but it is effectively screened out by the ozone layer of the atmosphere.
UV-B causes sunburn, but UV-A damages collagen (connective tissue) and blood vessels, causing aging effects such as wrinkled skin.
Sunscreens block the body's ability to make Vitamin D from sunlight. If you are using sunscreen a lot, or do not get much sun, getting supplemental Vitamin D in your diet may be a good idea.
Because governments only allow certain percentages of each UV absorbing compound, the higher SPF formulations generally have several UV absorbers in them.
For a more in-depth discussion of how sunscreens work, see the Chemistry lesson at the end of the section on PABA.