Melanin is a protein made by cells called melanocytes. These cells are found in the lower layers of the skin’s epidermis (stratum spinosum). Melanin is secreted by melanocytes and taken up by the keratinocytes that make up the majority of the epidermis
(the outer layer of the skin). This next part is super cool: the melanin is not just in any old place in the keratinocyte. It is specifically located on the “sunny side” of the nucleus. In other words, the melanin is placed between the nucleus of the keratinocyte
and sunlight, kind of like a molecular umbrella! Can you think why this might be important…? Sunlight contains ultraviolet radiation. Ultraviolet radiation can cause mutations in DNA. DNA is contained in the nucleus of the cell. So melanin is placed between
the DNA and the sun in order to absorb the ultraviolet radiation and protect the DNA from damage. DNA mutations do not always cause cancer, but cancer is the result of some DNA mutations. This is why darker skinned people have a lower incidence of skin cancer.
Darker skinned people make more melanin (as Kamran explained).