Sunlight holds more than the colours you can see. Just beyond violet lies ultraviolet light, the part of sunlight that burns skin.
Ultra means beyond. Ultraviolet light, or UV, has waves shorter than violet's 400 nm, too short for your eyes to see. Light arrives in tiny packets of energy called photons, and the shorter the wave, the more energy each photon carries. A photon of UV at 300 nm carries more than twice the energy of a photon of red light at 700 nm: enough to break some bonds and start reactions.
Scientists split ultraviolet light into three bands. UVC has the shortest waves and the most energy, then comes UVB, then UVA, next to violet. The ozone layer high in the air absorbs all the UVC and most of the UVB, so about 95% of the UV that reaches the ground is UVA.
What UV does to skin
UVB is the main cause of sunburn. The bases of DNA, the flat rings that pair up across the double helix, absorb UV light, including UVB. When two thymine bases sit side by side on one strand, a photon can open the C=C double bond in each, and the two rings join through a new ring of four carbon atoms. The joined pair puts a kink in the DNA.
Your cells have repair enzymes that cut out damaged stretches of DNA and rebuild them, and they fix most of this damage. Sunburn, the red, sore skin that shows up a few hours after too much sun, is the skin's response to it. A joined pair that is copied before it is repaired can change the DNA's instructions, and over many years changes like these can lead to skin cancer.
UVA carries less energy in each photon, and it reaches deeper into the skin. It harms DNA too, both by joining thymines as UVB does and by making reactive forms of oxygen that attack it, and it is the main cause of the wrinkles and dark spots of skin aged by the sun.