The World Health Organization, American Academy of Dermatology, and Skin Cancer Foundation recommend the following measures to prevent excessive UV exposure and skin cancer:
Limiting sun exposure between the hours of 10 am and 4 pm, when UV rays are the strongest
Seeking shade when UV rays are most intense
Wearing sun-protective clothing including a wide brim hat, sunglasses, and tightly-woven, loose-fitting clothing
Using sunscreen
Avoiding tanning beds and artificial UV exposure

UV intensity
The strength of sunlight is published in many locations as a UV Index. Sunlight is generally strongest when the sun is close to the highest point in the sky. Due to time zones and daylight saving time, this is not necessarily at 12 noon, but often one to two hours later. Seeking shade including using umbrellas and canopies can reduce the amount of UV exposure, but does not block all UV rays. The WHO recommends following the shadow rule: "Watch your shadow – Short shadow, seek shade!" Grapes
A 2022 study found that eating 60 grapes a day can stop you getting sunburn. Scientists found people who ate three-quarters of a punnet every day for two weeks were better protected against damage to the skin from ultraviolet light. Polyphenols found naturally in the fruits are thought to be responsible for the resistance. Sunscreen
Commercial preparations are available that block UV light, known as sunscreens or sunblocks. They have a sun protection factor (SPF) rating, based on the sunblocks ability to suppress sunburn: The higher the SPF rating, the lower the amount of direct DNA damage.
However, all skin types can develop sunburn.Fitzpatricks skin phototypes:

Type 0: Albino
Type I: Pale white skin, burns easily, does not tan
Type II: White skin, burns easily, tans with difficulty
Type III: White skin, may burn but tans easily
Type IV: Light brown/olive skin, hardly burns, tans easily
Type V: Brown skin, usually does not burn, tans easily
Type VI: Black skin, very unlikely to burn, becomes darker with UV radiation exposureAge also affects how skin reacts to sun. Children younger than six and adults older than sixty are more sensitive to sunlight.There are certain genetic conditions, for example xeroderma pigmentosum, that increase a persons susceptibility to sunburn and subsequent skin cancers. These conditions involve defects in DNA repair mechanisms which in turn decreases the ability to repair DNA that has been damaged by UV radiation. Medications
The risk of a sunburn can be increased by pharmaceutical products that sensitize users to UV radiation. Certain antibiotics, oral contraceptives, antidepressants, acne medications, and tranquillizers have this effect. UV intensity
The UV Index indicates the risk of getting a sunburn at a given time and location. Contributing factors include:
The time of day. In most locations, the suns rays are strongest between approximately 10 am and 4 pm daylight saving time. Cloud cover. UV is partially blocked by clouds; but even on an overcast day, a significant percentage of the suns damaging UV radiation can pass through clouds. Proximity to reflective surfaces, such as water, sand, concrete, snow, and ice. All of these reflect the suns rays and can cause sunburns. The season of the year.