With the summer sun beating down, spending quality time outside—whether you’re working out or vacationing—is a given. And though you likely know all the rules about wearing sunscreen, sometimes you just forget. Sunburns are no fun and can be dangerous, but there are ways to alleviate the pain and soothe the burn.

What You Need to Know

Sunburns are most common among adults 18 to 29 years old. In fact, 65 percent of white people in that age group reported at least one sunburn in the past year, according to the CDC.Sunburn and sun protective behaviors among adults aged 18-29 years–United States, 2000-2010.. MMWR. Morbidity and mortality weekly report, 2012, Jun.;61(18):1545-861X.

And this may come as no surprise, but it’s not the heat that’s causing that burn. Excessive exposure to ultraviolet (UV) light does the damage. When exposed to UV rays from the sun, your skin accelerates the production of melanin—a substance that gives pigment to your skin and gives you your natural color. That melanin-in-overdrive is what gives you a tan. And that tan is your body’s natural sunblocker—and the only defense you naturally have against the sun.

But the melanin can only do so much. How much melanin your body can produce is determined by genetics, and most people don’t produce enough to protect the skin well. The eventual result is a sunburn.

But it goes beyond red skin and weird tan lines. In some cases, blisters can form, and the skin may even swell—a condition called edema. In more severe situations, sun poisoning a.k.a. polymorphic light eruption—can occur. Symptoms of this type sun allergy include tiny red bumps or patches of red skin, blisters, hives, and even bleeding.

Studies have shown that getting burned regularly can significantly increase a person’s risk of developing skin cancer later in life. In particular, one study found that women who got five or more blistering sunburns between the ages of 15 and 20 were at an 80 percent increased risk for melanoma.Long-term ultraviolet flux, other potential risk factors, and skin cancer risk: a cohort study. Wu S, Han J, Laden F. Cancer epidemiology, biomarkers & prevention : a publication of the American Association for Cancer Research, cosponsored by the American Society of Preventive Oncology, 2015, Jun.;23(6):1538-7755. Melanoma is the most serious type of skin cancer and requires immediate attention from a doctor.

Your Action Plan

Be smart in the sun. The easiest way to treat a sunburn is to prevent it from happening in the first place. Apply sunscreen regularly. The American Academy of Dermatology recommends using one that is broad spectrum (meaning it protects against UVA and UVB rays), water resistant, and has an SPF (sun protection factor) of 30 or higher. You should also consider staying out of the sun during the middle of the day (10 a.m. to 4 p.m.), wearing protective clothing, and avoid tanning beds. You can also chow down on some sun-friendly foods, like salmon, which contains omega-3 fatty acids that may help block some UV rays.Dietary fish-oil supplementation in humans reduces UVB-erythemal sensitivity but increases epidermal lipid peroxidation. Rhodes LE, O’Farrell S, Jackson MJ. The Journal of investigative dermatology, 1994, Aug.;103(2):0022-202X.

If it’s too late, here’s how to treat your burn:

Originally published August 2012. Updated July 2015.