Cavities form when acids produced by bacteria in your mouth dissolve the mineral structure of your teeth. This process, called demineralization, begins when the pH on a tooth’s surface drops below about 5.5. Your teeth are constantly gaining and losing minerals throughout the day, and a cavity develops when the balance tips toward loss for long enough that the damage becomes permanent.
What Happens on the Surface of Your Teeth
Your mouth is home to hundreds of species of bacteria. They live in a sticky film called plaque that coats your teeth, especially in hard-to-reach areas. These bacteria feed on the same carbohydrates you eat, particularly sugars. When they break down those sugars, they produce strong organic acids, primarily lactic acid, as a byproduct. This is the same basic fermentation process that makes yogurt sour, except it’s happening directly on the surface of your teeth.
Tooth enamel is made of a crystalline mineral called hydroxyapatite. It’s the hardest substance in the human body, but it has a specific chemical weakness: acid dissolves it. When bacterial acids push the pH at the tooth’s surface below 5.5, the hydroxyapatite crystals begin to break apart, releasing calcium and phosphate ions into the surrounding fluid. Each time you eat something sugary or starchy, bacteria ramp up acid production and the pH drops. This acid attack can last 20 to 30 minutes after eating before your saliva gradually neutralizes things and brings the pH back up.
How Your Mouth Fights Back
Saliva is your primary natural defense against cavities. It does three things that matter here. First, it acts as a buffer, neutralizing acids and raising the pH back to safe levels. Second, it carries dissolved calcium and phosphate ions. At a normal, neutral pH, saliva is actually supersaturated with these minerals, meaning there’s more dissolved mineral available than the surrounding environment can hold. This creates the right conditions for minerals to redeposit onto tooth surfaces that have been weakened, a process called remineralization.
Third, saliva physically washes away food particles and bacteria. This is one reason a dry mouth (from medications, dehydration, or certain medical conditions) significantly increases cavity risk. Without enough saliva, acids linger longer and the raw materials for repair aren’t delivered to where they’re needed. Remineralization also requires partially damaged crystals still in place to act as scaffolding for new mineral deposits. Once the damage is too extensive, there’s nothing left for minerals to rebuild onto.
Fluoride supercharges this repair process. When fluoride ions replace some of the hydroxyl groups in enamel’s crystal structure, the result is a mineral called fluorapatite. It’s harder, less soluble, and more resistant to acid than the original hydroxyapatite. This is why fluoride toothpaste and fluoridated water reduce cavity rates: they don’t just clean teeth, they chemically upgrade the enamel surface to better withstand acid attacks.
From White Spot to Full Cavity
A cavity doesn’t appear overnight. In most cases, the process takes months to years, though poor oral hygiene can accelerate the timeline dramatically. The progression follows a predictable sequence, and the early stages are actually reversible.
The first visible sign is a white spot lesion. This is a chalky, opaque patch on the tooth where minerals have been lost from just below the surface. The outermost layer of enamel often stays relatively intact at this point because it gets the most contact with fluoride and remineralizing saliva. Underneath, though, the enamel is becoming porous. At this stage, improved brushing, fluoride treatments, and dietary changes can reverse the damage completely.
If the acid challenge continues, the enamel surface starts breaking down. First it becomes rough, then small microcavities form as the surface porosity increases. Eventually the weakened surface collapses entirely, leaving a visible hole. This is the point most people think of as “getting a cavity,” and it’s no longer reversible with remineralization alone.
Once the decay penetrates through the enamel, it reaches the dentin, the softer, yellowish layer underneath. Dentin is less mineralized than enamel and has a higher critical pH for dissolving (around 6.0 instead of 5.5), so decay spreads faster here. The tooth tries to protect itself by producing a layer of defensive dentin between the decay and the innermost pulp, where the nerves and blood vessels are. If bacteria reach the pulp, the result is typically intense pain and the need for a root canal or extraction.
Where Cavities Are Most Likely to Start
Not all tooth surfaces face equal risk. The chewing surfaces of your back teeth (molars and premolars) are the most vulnerable because they’re covered in pits and fissures. These are narrow grooves and invaginations in the enamel that can be shaped like funnels, hourglasses, or branching Y-shaped channels. Their complex, irregular shapes make them nearly impossible to clean with a toothbrush, creating sheltered environments where bacteria accumulate undisturbed. These areas also get less benefit from fluoride in toothpaste or water compared to the smooth, exposed surfaces of teeth.
The areas between teeth are another high-risk zone, which is why flossing matters. Bacteria thrive in the tight contact points where two teeth touch because toothbrush bristles can’t reach there. The gumline is similarly vulnerable, especially as gums recede with age and expose the root surface, which lacks enamel entirely and is covered only by a thinner mineral layer called cementite.
Why Sugar Matters, and How
The link between sugar and cavities is well established, but the details are more nuanced than “sugar is bad for your teeth.” For decades, dentists emphasized that the frequency of sugar consumption mattered more than the total amount. The logic was straightforward: each sugar exposure triggers a new acid attack, so snacking all day would be worse than eating the same amount at one meal.
More recent research complicates this picture. A large study of U.S. adults found that the total amount of added sugar consumed was more consistently and strongly associated with cavities than the frequency. An increase of about 55 grams per day in added sugar intake (roughly the amount in a 16-ounce soda) was associated with an 11% higher cavity score, while eating sugar more times per day showed a weaker or statistically insignificant relationship after accounting for total intake. Both factors play a role, but cutting overall sugar consumption appears to matter more than simply consolidating when you eat it.
It’s also worth noting that bacteria don’t distinguish between “natural” and “added” sugars when it comes to acid production. Honey, fruit juice, and dried fruit all feed oral bacteria the same way table sugar does. Starchy foods like chips and crackers can also contribute, since enzymes in saliva begin breaking starches into sugars right in your mouth.
What Tips the Balance Toward Decay
A cavity forms when demineralization consistently outpaces remineralization over time. Several factors shift this balance in the wrong direction. Frequent snacking keeps the pH low for longer stretches, giving saliva less time to repair damage between acid attacks. A diet high in sugar and refined carbohydrates provides more fuel for acid-producing bacteria. Inadequate brushing and flossing allow plaque to build up into thicker layers, concentrating acid directly against the tooth surface.
Certain bacteria are better cavity-causers than others. Species like Streptococcus mutans are especially efficient at fermenting carbohydrates into strong acids. They also thrive in acidic conditions that would suppress other, less harmful bacteria. As the mouth’s environment becomes more acidic over time, these aggressive species gain a competitive advantage, producing even more acid in a self-reinforcing cycle. This is why cavity risk can seem to snowball: once conditions favor acid-producing bacteria, the microbial community shifts in a direction that makes cavities more likely.
On the protective side, consistent fluoride exposure, adequate saliva flow, thorough daily plaque removal, and lower sugar intake all keep remineralization ahead of demineralization. The process of cavity formation is slow and, in its early stages, entirely reversible. The goal isn’t to eliminate bacteria from your mouth (that’s impossible and unnecessary) but to keep the chemical environment tilted in your teeth’s favor.

