When I was in my teens and early 20s, I got canker sores all the time. My hunch is this signaled a problem with my immune system. Robert Wergin, MD, president of the American Academy of Family Physicians, agrees that's entirely possible.

“We know one thing that’s correlated with canker sores is a compromised immune system,” he says, “but we don’t know for sure what causes them.”

Canker sores aren't dangerous, but those small craters in the mouth can be terribly painful. Is there any way to get rid of them — or better yet, prevent them in the first place?

Related: How to Prevent Cold Sores

A down-in-the-mouth pain

Canker sores, aka aphthous ulcers, are shallow red sores that often have a white coating and erupt in the mouth, typically on the insides of cheeks or lips, on or under the tongue and at the base of gums. They usually last a week to 10 days. According to Wergin, women, teens and young adults in their 20s (bingo!) are most likely to get them.

What causes canker sores? As Wergin says, no one quite knows. But according to the Mayo Clinic, possible triggers for canker sores include:

  • Emotional stress
  • A diet low in zinc, vitamin B12, folate or iron
  • Food sensitivities
  • Menstrual periods and other hormonal shifts
  • Mouth injuries — from a dental mishap, say, or sports accident
  • Overly vigorous toothbrushing
  • An allergic reaction to certain types of mouth bacteria
  • Sodium lauryl sulfate, a common ingredient in toothpaste

Related: Does Oil Pulling for Healthy Teeth Really Work?

Heading off and helping heal canker sores 

The stronger your immune system and the healthier your mouth, the better able you’ll be to fight off canker sores, as well as deal with them if they pop up anyway, Wergin says. Here are some tips.

Eat a healthy diet. Since canker sores often accompany vitamin deficiencies, chowing down on produce, whole grains and low-fat protein won't hurt. Research doesn't show supplements help, though. “Vitamin D, vitamin C and lysine have been pushed for preventing canker sores, but there’s no evidence to support that,” Wergin adds.

Avoid certain foods. According to the American Dental Association (ADA), "There is no cure for canker sores, but you may be able to reduce how often you get them by avoiding foods that irritate your mouth." For many people these include spicy foods, citrus fruits and foods with a high acid content, like pickles. The ADA suggests that if you do develop canker sores, stick to bland foods until they go away.

Ramp up your dental hygiene. Brushing and flossing every day also discourages canker sores by keeping your mouth clean, according to Wergin. (Just don’t brush too hard!)

Related: Open Wide! What Your Mouth is Telling You About Your Health

Switch to a new toothpaste. The evidence linking canker sores to sodium lauryl sulfate is conflicting, according to Joe Graedon, MS, of the People’s Pharmacy website. Even so, some dentists feel it’s worth trying brands that don’t contain this common toothpaste ingredient to see if it makes a difference.

Try “magic mouthwash.” For extremely painful canker sores, Wergin suggests asking your doctor or pharmacist about what he calls “magic mouthwash” — typically a mixture of lidocaine, Mylanta and Benadryl. Note that it can have other formulations that include antibiotics and hydrocortisone, so make sure your doctor knows if you're pregnant, nursing or have a systemic fungal infection if he suggests you try it.  

Give it gel. An over-the-counter product such as Orajel that forms a barrier over the sore may relieve the pain. Before using a product that contains benzocaine, though, check with your doctor. Scientists have linked pain-relieving gels for teeth and gums that contain this ingredient with a rare but potentially fatal condition.

When to see your doctor

Canker sores usually are harmless, but Wergin suggests having a doctor check them out under these circumstances:

  • If your sores tend to be large and painful
  • If they last more than 10 days or if you get them more than three times a year. In this case they may be cold sores (fever blisters), which are caused by a herpes simplex virus and require a different treatment.
  • If you have other symptoms such as swollen glands, eye pain, fever, arthritis or conjunctivitis (pink eye)

Kathryn Olney is a freelance writer and editor who has served as a reporter and editor for California, San Francisco and Mother Jones magazines.