When your skin is exposed to sunlight, it produces a pigment called melanin to help protect itself against ultraviolet light. This is what makes your skin go darker and is what you see as a suntan.
A sunburn is a burn to your skin tissue from overexposure to ultraviolet (UV) radiation from the sun’s rays. With too much exposure to UV light, your skin overheats and becomes red and painful, and may later peel or blister.