We know, you didn’t mean to get sunburned. You lost track of time, or nodded off, and now you can tell you’re going to be lobster-red and miserable. It can take several hours for the full damage to show itself. So at the first sign, get out of the sun and follow this expert advice from dermatologist Jeffrey Brackeen, MD, a member of The Skin Cancer Foundation.

Nobody’s perfect, and a sunburn can happen. But it’s important to take it seriously and stop it from happening again. Your risk for melanoma doubles if you’ve had more than five sunburns.

1. Act Fast to Cool It Down

If you’re near a cold pool, lake or ocean, take a quick dip to cool your skin, but only for a few seconds so you don’t prolong your exposure. Then cover up and get out of the sun immediately. Continue to cool the burn with cold compresses. You can use ice to make ice water for a cold compress, but don’t apply ice directly to the sunburn. Or take a cool shower or bath, but not for too long, which can be drying, and avoid harsh soap, which might irritate the skin even more.

2. Moisturize While Skin Is Damp

While skin is still damp, use a gentle moisturizing lotion (but not petroleum or oil-based ointments, which may trap the heat and make the burn worse). Repeat to keep burned or peeling skin moist over the next few days.

3. Decrease the Inflammation

At the first sign of sunburn, taking a nonsteroidal anti-inflammatory drug (NSAID), such as ibuprofen, naproxen or aspirin, can help with discomfort and inflammation, says Dr. Brackeen, who practices at the Skin Cancer Institute in Lubbock, Texas. You can continue with the NSAIDs as directed till the burn feels better. You can also use a 1 percent over-the-counter cortisone cream as directed for a few days to help calm redness and swelling. Aloe vera may also soothe mild burns and is generally considered safe. Wear loose, soft, breathable clothing to avoid further skin irritation, and stay out of the sun.

4. Replenish Your Fluids

Burns draw fluid to the skin’s surface and away from the rest of the body, so you may become dehydrated, explains Dr. Brackeen. It’s important to rehydrate by drinking extra liquids, including water and sports drinks that help to replenish electrolytes, immediately and while your skin heals.

5. See a Doctor If …

You should seek medical help if you or a child has severe blistering over a large portion of the body, has a fever and chills, or is woozy or confused. Don’t scratch or pop blisters, which can lead to infection. Signs of infection include red streaks or oozing pus.

Bottom line: Your skin will heal, but real damage has been done. “Repeat sunburns put you at a substantial risk for skin cancer and premature skin aging, and I want people to ‘learn from the burn,’” Dr. Brackeen says. Review the guidelines in The Skin Cancer Foundation’s Prevention Handbook. Remember how bad this sunburn felt, then commit to protecting yourself from the sun every day, all year long.