After exposure to the sun, your capillaries dilate, causing the skin to appear pink. Then, skin cells release a chemical that triggers inflammation. Within 12 hours, skin cells begin to die and the inflammation reddens. A tan forms when your skin cells release a pigment to help block your skin from UV rays. (And, no, you shouldn't consider a tan "protection" from the sun. Burn or tan, it all boils down to one thing -- skin damage.)
The redness in the skin in a sunburn is caused by the dilation of small blood vessels called capillaries in the skin. When the skin is damaged there is an inflammatory response that occurs, like other injuries to the body. There is a release of histamine to the skin that is the start of the inflammatory process. This inflammatory response is what triggers the dilation of the blood vessels and the pain.
Sun burn causes due to continuous sun rays on our body, the upper layer is having more temperature as compared to the other inner layers. As for long time the sun rays strike out skin which causes our some cells dead or supply of blood is restricted. Therefore the color turns red or tan.
When you get sunburn your skin is damaged and need to be repaired slowly over a few days. it turns red because the skin is irritated and inflamed that’s why it hurts so much the pain is meant to get you to stop but yet we keep tanning. good luck!