Melanocytes are prompted to produce additional melanin whenever ultraviolet light waves touch them, thereby making the skin darker to protect the body from additional exposure. This produces a tan—literally, a browning of the skin. The color of the tan ultimately depends on heredity and previous exposure to ultraviolet light, two factors which predetermine the amount of melanin your skin will contain and be able to produce. This explains why some fair-skinned people can get dark tans and others cannot.
Of course, ultraviolet light can affect the skin in other ways. In excessive doses, it can cause sunburn – a reddening caused by the swelling or bursting of tiny blood vessels in the skin. Repeated burning is believed to be the greatest risk factor for long-term skin damage, which is why it is so important to prevent sunburn with moderate exposure.
UVA and UVB waves have specific roles in the tanning process which are determined by their effects on skin. Although all ultraviolet light is capable of tanning skin, UVA is more efficient at oxidizing the current melanin in your skin and UVB is more efficient at signaling your melanocytes to produce more melanin. Melanin produced when your skin is exposed to UV light is naturally pinkish in tone, and as it rises to the surface of the skin the melanin oxidizes with contact to oxygen and more UV light. When this process is complete the result is a "sun tan".
UVB is more efficient at signaling melanocytes in your skin to begin producing more melanin.