Cavities form when acids dissolve the mineral structure of your teeth faster than your body can repair it. This process is happening in almost every mouth, all the time. Whether you actually end up with a cavity depends on how that balance tips, and it’s rarely about just one thing. Diet, bacteria, saliva, genetics, medications, and even how you breathe at night all play a role.
How a Cavity Actually Forms
Your tooth enamel is made of tightly packed mineral crystals, primarily calcium and phosphate. These crystals are strong, but they start dissolving when the environment around them becomes acidic, specifically when the pH on your tooth surface drops below 5.5. For reference, pure water has a neutral pH of 7.0, so it doesn’t take much acidity to cross that threshold.
The acid comes from two main sources. The first is bacteria in your mouth. Certain species feed on sugars and starches from your food and produce lactic acid as a byproduct. That acid sits against your tooth surface and pulls calcium and phosphate ions out of the enamel. The second source is acidic foods and drinks themselves, things like soda, citrus juice, sports drinks, and wine, which bathe your teeth in acid directly.
Your body does fight back. Saliva contains bicarbonate, calcium, and phosphate that neutralize acid and push minerals back into weakened enamel. This repair process is called remineralization, and it’s happening throughout the day. A cavity only develops when acid attacks outpace this natural repair over weeks and months. The earliest sign is a white spot on the tooth, a patch where minerals have started leaching out but the surface hasn’t broken yet. From that white spot stage, it takes roughly 18 months (give or take 6 months) for a full cavity to form on a smooth tooth surface. That’s a wide window where the damage is still reversible.
The Bacteria Behind Most Cavities
Your mouth is home to hundreds of bacterial species, but one stands out as the primary driver of tooth decay: Streptococcus mutans. This bacterium is especially effective at causing cavities for a few reasons. It thrives on sugar, particularly sucrose (table sugar), and converts it into lactic acid more efficiently than most other oral bacteria. It also uses sucrose to manufacture a sticky, glue-like substance that helps it anchor to your teeth and build a protective three-dimensional structure. That structure is dental plaque.
Plaque isn’t just cosmetic grime. It’s a living bacterial community encased in a matrix of sugary polymers, which account for about 40% of plaque’s dry weight. This matrix traps acid against the tooth surface and blocks saliva from reaching it to neutralize the pH. So even if you have plenty of saliva, a thick layer of plaque can create a pocket of sustained acidity right where it does the most damage. This is why brushing and flossing matter: they physically break up these bacterial colonies before they can do serious harm.
Why Some People Are More Prone Than Others
If you brush regularly and still get cavities, your biology may be working against you. Several factors that you can’t fully control influence your risk.
Enamel quality. Not everyone’s enamel is equally tough. A group of genetic conditions called amelogenesis imperfecta cause enamel to form too thin, too soft, or without enough calcium. These conditions result from mutations in genes that control enamel development. Even without a formal diagnosis, natural variation in enamel thickness and mineral density means some people simply have teeth that dissolve faster under the same acid exposure.
Saliva production. Saliva is your mouth’s primary defense system. It rinses away food particles, neutralizes acid through its bicarbonate buffering system, and delivers calcium and phosphate back to weakened enamel. When saliva production drops, acid lingers longer and remineralization slows. Some people naturally produce less saliva, and the composition of their saliva (how much buffering capacity it has) varies from person to person.
Mouth bacteria. The specific mix of bacteria in your mouth is partly shaped by what you were exposed to early in life. People with higher populations of S. mutans face a steeper uphill battle, even with good hygiene. Research has shown that mouth breathers accumulate more plaque and harbor significantly larger colonies of cavity-causing bacteria than nose breathers, likely because the airflow dries out the mouth and disrupts the protective environment saliva creates.
Medications and Dry Mouth
Hundreds of common medications reduce saliva production as a side effect. Blood pressure drugs, antidepressants, antihistamines, and bladder-control medications are among the most frequent culprits. If you started a new medication and noticed your mouth feeling drier, that change alone can dramatically shift the balance toward decay. Without adequate saliva, harmful bacteria go unchecked, acid isn’t neutralized as quickly, and your enamel loses its main source of repair minerals.
This is one of the most overlooked reasons people who “never had cavities” suddenly start getting them in their 30s, 40s, or later. The change isn’t in their brushing habits. It’s in their saliva.
What You Eat and Drink Matters More Than You Think
Sugar gets the most attention, and rightly so. Every time you eat something sweet or starchy, bacteria in your mouth produce acid for roughly 20 to 30 minutes afterward. If you’re snacking frequently throughout the day, your teeth spend most of their time in an acidic environment with little opportunity for saliva to repair the damage between exposures. The total amount of sugar matters less than how often you expose your teeth to it.
But sugar isn’t the only problem. A 2016 study measuring 379 commercially available beverages in the U.S. found that 93% had a pH below 4.0. Soft drinks, sports drinks, and fruit juices typically range from pH 2.0 to 3.5, well below the 5.5 threshold where enamel starts dissolving. These drinks don’t need bacteria to cause damage. They erode enamel directly on contact. Sipping a soda over an hour is far worse than drinking it quickly, because it extends the time your teeth sit in acid.
Diet sodas aren’t off the hook either. They contain the same acids (phosphoric acid, citric acid) as regular versions. The absence of sugar removes the bacterial food source, but the direct erosion still happens.
Breathing, Sleep, and Overnight Decay
Saliva production naturally drops while you sleep, which is why your mouth feels drier in the morning. If you also breathe through your mouth at night, the effect compounds. Air flowing across your oral tissues dries them out further, and research has found that mouth breathers accumulate more plaque and have higher levels of decay-causing bacteria than nose breathers.
This means the hours you spend sleeping can be some of the highest-risk time for your teeth. Brushing right before bed removes the bacterial film and food residue that would otherwise sit undisturbed all night. Skipping that nighttime brushing is consistently more damaging than skipping a morning session.
How Fluoride Changes the Equation
Fluoride works by swapping into the mineral structure of your enamel, replacing some of the original crystal with a slightly different form that resists acid better. This altered mineral dissolves at a lower pH than untreated enamel, meaning your teeth can withstand more acid exposure before damage begins. Fluoride also helps drive calcium and phosphate back into weakened spots, accelerating the natural repair process.
This is why fluoride toothpaste is the single most evidence-backed tool for cavity prevention. It doesn’t just clean your teeth. It chemically strengthens them twice a day. If you’re cavity-prone, your dentist may also recommend a higher-concentration fluoride rinse or gel to give your enamel additional protection.
Putting It All Together
Cavities are rarely caused by one single failure. They result from a combination of factors tipping the balance: frequent sugar or acid exposure feeding bacteria, plaque that isn’t removed often enough, saliva that can’t keep up with the acid load, or enamel that was vulnerable to begin with. If you’re frustrated by cavities despite good habits, consider the less obvious contributors. A medication you take, nighttime mouth breathing, frequent snacking or sipping acidic drinks throughout the day, or simply the bacterial mix you inherited can all be enough to push you over the edge. Identifying which factors apply to you is the most useful step toward actually changing the pattern.