Before we delve into the specifics of the SPF system of measuring sunscreen, it is important to discuss the two (well, technically three) types of ultraviolet rays.
Essentially all UV-C light is blocked by diatomic oxygen or ozone. Most UV-B radiation is blocked by the ozone layer, and UV-A is unaffected. Now, let's dig deeply into the two that we see in the troposphere: UVA and UVB.
UVA (95% of all UV)
This is the longer wavelength UV light, meaning it is lower energy (Maxwell's law: The energy of a photon is inversely proportional to its wavelength). Just like how red light penetrates deeper into the atmosphere during sunsets, UVA penetrates deeper into the skin, into the dermis, which contains collagen and elastin. As UVA radiation continues, the dermis thins, resulting in the epidermis to droop and wrinkle. UVA thus is the main cause of photoaging. Additionally, UVA is the main contributor of tanning, which will be discussed later. In addition, it is a significant cause of melanoma through indirect DNA damage.
UVB (5% of all UV)
UVB is mainly responsible for burning, doing this through direct DNA damage.
What is happening above is DNA absorbs the energy of a UVB ray. If there happen to be two adjacent thymine base pairs, they will combine to form a pyrimidine dimer/thymine dimer. This is unusable, and the body responds in multiple ways. It triggers apoptosis, or cell death. Skin also peels in order to remove the now-dead cells. Finally, a potentially beneficial side effect is the production of melanin to defend the body against future DNA damage.
Clouds can only block UVB rays. When it is completely overcast, only about 1/10 of the UVB rays go through. However, there is an effect called the broken-cloud effect which results in higher UVB radiation on average. This is because the UV rays reflect off the broken clouds, meaning even shady areas receive UV radiation.
Glass also blocks UVB rays well. In cars, the windshield is specially coated to block UVA rays, but the windows are not treated, so UVA rays still permeate through.
How does tanning work?
There are two methods of tanning in humans: the oxidation of melanin, and melanogenesis (creation of more melanin). Melanin is a pigment found in skin that is very effective in absorbing light (99.9% of UV radiation).
Oxidation of Melanin
UVA radiation causes melanocytes to release its melanin which reacts with oxygen to produce the tanning color. It is important to note that the actual amount of melanin does not change because of this.
UVB radiation, which causes direct DNA damage, also results in the production of more melanin, or melanogenesis. Melanin absorbs UV radiation very well, and a tan can actually provide protection of SPF 3. The tan that results lasts for a few months.
How does skin cancer occur?
Direct DNA Damage
Direct DNA damage is the result of UVB radiation in which thymine dimers form, described above. However, instead of cell death, the cell may be mutated to create a tumor.
Basal-Cell Carcinoma (BCC)
This is the most common kind of skin cancer. It grows very slowly and is unlikely to result in death.
Squamous-Cell Skin Cancer (SCC)
This is more dangerous than BCC, but not as dangerous as melanoma. If treated quickly, the prognosis is generally good, but still 51,000 out of 2.2 million affected die every year.
Indirect DNA Damage
When UVA light is absorbed by some molecule, like melanin or DNA, they convert energy into heat, minimizing damage. UVA is less powerful, so it doesn’t immediately damage the DNA. Some molecules cannot convert energy into heat, and they remain in an excited state for a prolonged period of time. One such molecule is a chromophore, which is responsible for color. Because of its high energy, it facilitates a reaction to form a "reactive oxygen species", or a harmful version of oxygen. This harmful oxygen can react with DNA and damage it.
This is the most dangerous form of skin cancer, as it isn't always as obvious. Because its cause is an indirect way of damaging DNA (reacting with oxygen then reacting with DNA), it may not necessarily form in areas exposed to the sun including in the intestines, mouth, or eye.
Now, what does SPF mean?
SPF, or sun protective factor, measures the fraction of UVB radiation that reaches the skin. Equivalently, it is the multiplicative factor of time longer you can be in the sun without being burnt. The reason it is UVB is because it causes sunburn, so its effects can be easily seen.
For example, SPF 15 means that 1/15 of UVB radiation reaches the skin, meaning one can last 15 times as long before being sunburnt. Although SPF only quantifies UVB radiation, most sunscreens are broadband, meaning they protect against UVA as well. There is a star rating system that measures how well UVA rays are blocked, but it is not required in American sunscreens.