What Causes a Cavity? Bacteria, Sugar, and Acid

Cavities form when acids produced by bacteria in your mouth dissolve the mineral structure of your teeth. It’s a process that usually unfolds over months or years, driven by a cycle of acid attacks that eventually eat through the tooth’s outer layer and into the softer tissue underneath. About 21% of American adults between 20 and 64 have at least one untreated cavity right now, making it one of the most common chronic conditions in the country.

How Bacteria Turn Sugar Into Acid

Your mouth is home to hundreds of bacterial species, but one in particular plays an outsized role in tooth decay: Streptococcus mutans. This bacterium thrives on simple sugars like glucose and sucrose. When you eat something sweet, S. mutans metabolizes those sugars and produces lactic acid as a byproduct. In environments with excess sugar, it shifts almost entirely to lactic acid production, creating a highly acidic microenvironment on the tooth surface.

S. mutans also has a competitive advantage over other oral bacteria. It builds a sticky matrix on the tooth surface (this is the plaque you feel when you haven’t brushed), and the acid it generates actually kills off competing bacterial species that can’t survive in low-pH conditions. The result is a self-reinforcing cycle: more sugar means more acid, more acid means fewer competitors, and fewer competitors means S. mutans dominates even further. Other acid-producing species like Lactobacillus casei contribute to the process, but S. mutans is the primary driver.

What Acid Does to Your Teeth

Tooth enamel is made of a crystalline mineral called hydroxyapatite, a tightly packed structure of calcium and phosphate. When bacterial acid lowers the pH on the tooth surface, hydrogen ions from the acid bind to the phosphate in the enamel crystal, pulling calcium and phosphate ions out of the structure. Think of it as chemical etching: the acid doesn’t melt the tooth so much as it unbonds the mineral lattice one ion at a time.

This process is called demineralization, and it happens every time you eat. What prevents it from destroying your teeth is that your saliva normally reverses the damage. Saliva is naturally supersaturated with calcium and phosphate ions, so once the acid is neutralized, those minerals flow back into the enamel and rebuild the crystal structure. This back-and-forth between mineral loss and mineral repair happens constantly throughout the day. A cavity forms when the balance tips toward loss, either because acid attacks are too frequent, too prolonged, or your saliva can’t keep up.

Why Frequency Matters More Than Amount

The total amount of sugar you eat matters less than how often you eat it. Every time carbohydrates hit your teeth, bacteria produce acid for roughly 20 to 30 minutes. If you sip a sugary drink over three hours, you’re bathing your teeth in acid almost continuously. If you drink the same amount in five minutes with a meal, the acid attack is brief and your saliva can recover.

Not all carbohydrates are equally harmful. Sucrose (table sugar) has the greatest cavity-causing potential among common dietary sugars. Solid, sticky forms of sugar that cling to teeth are worse than liquids, because they extend the duration of acid exposure. Starches are less damaging on their own but still contribute, especially processed starches that break down quickly in the mouth. Even lactose, the sugar in milk, is mildly cariogenic. The key variable across all of them is how long they stay in contact with your teeth and how often that contact happens.

The Stages of a Cavity

Cavities don’t appear overnight. The first visible sign of trouble is a white spot lesion: a small, chalky white patch on the tooth that looks different from the surrounding enamel. This white spot represents mineral loss beneath the tooth surface while the outermost layer of enamel remains mostly intact. At this stage, the damage is reversible. Improved brushing, reduced sugar intake, and fluoride exposure can allow the tooth to remineralize and heal itself.

If the acid attacks continue, the enamel surface becomes increasingly porous until tiny microcavities form. At this point, bacteria can penetrate deeper into the tooth. Eventually the weakened surface collapses, leaving a visible hole. Once decay reaches the dentin, the softer layer beneath the enamel, it spreads faster because dentin is less mineralized and more vulnerable to acid. Left untreated, the decay can reach the pulp (the nerve and blood supply inside the tooth), which typically causes significant pain and requires more invasive treatment.

An active cavity tends to look whitish, feels rough to the touch, and collects plaque easily. An inactive or arrested lesion, by contrast, appears brownish, smooth, and shiny. This distinction matters because not every dark spot on a tooth is actively getting worse.

How Saliva Protects Your Teeth

Saliva is your body’s primary defense against cavities. It works through three main mechanisms: buffering acid, supplying minerals, and fighting bacteria directly.

  • Buffering: Saliva contains three buffer systems, the most important being a bicarbonate system that neutralizes acid and brings the mouth back to a safe pH after eating.
  • Mineral supply: At normal pH, saliva is supersaturated with calcium and phosphate, creating the conditions for enamel to rebuild itself between acid attacks.
  • Antimicrobial proteins: Saliva contains proteins like lactoferrin, which starves S. mutans by removing iron from the oral environment, and histatins, which have direct antibacterial effects. Other proteins bind to the enamel surface and concentrate calcium right where it’s needed for repair.

Anything that reduces saliva flow dramatically increases your cavity risk. This is why dry mouth is one of the strongest risk factors for tooth decay.

Risk Factors That Shift the Balance

Beyond diet and brushing habits, several factors can tip the demineralization-remineralization balance toward decay.

Dry mouth (xerostomia) is the big one. Without adequate saliva, your teeth lose their primary chemical defense. Hundreds of common medications cause dry mouth at rates of 10% or higher, including antidepressants, blood pressure medications, antihistamines, diuretics, muscle relaxants, sedatives, and opioid painkillers. If you take any of these and notice your mouth feels persistently dry, your cavity risk is elevated. Medical conditions like Sjögren syndrome, poorly controlled diabetes, and autoimmune disorders also reduce saliva production. Radiation therapy to the head and neck can damage salivary glands permanently.

Acid reflux introduces stomach acid (with a pH around 1.2) directly into the mouth, well below the threshold where enamel dissolves. This kind of acid exposure can cause widespread erosion that no amount of brushing will prevent until the reflux itself is managed. Frequent vomiting from any cause has the same effect.

Children and older adults face elevated risk for different reasons. About 18% of children aged 6 to 8 have untreated decay in their baby teeth, partly because primary teeth have thinner enamel. In adults over 65, receding gums expose the tooth root, which lacks enamel entirely and decays more readily. Even so, untreated decay in that age group (about 13%) is actually lower than in working-age adults, possibly reflecting more consistent dental care in retirement.

How Fluoride Changes the Chemistry

Fluoride prevents cavities by altering the mineral structure of your teeth at a molecular level. When fluoride ions contact enamel, they swap into the hydroxyapatite crystal, replacing hydroxyl groups. This creates fluorapatite, a mineral that is significantly more resistant to acid dissolution. The exchange happens readily even at low fluoride concentrations, which is why fluoridated water and toothpaste are effective despite delivering relatively small amounts of fluoride.

Fluoride also promotes remineralization. When your saliva is working to repair early acid damage, the presence of fluoride makes the rebuilt mineral layer harder and more acid-resistant than the original enamel. This is why fluoride toothpaste can reverse white spot lesions if they’re caught early enough. The fluoride doesn’t just prevent damage; it helps your teeth come back stronger from the damage that’s already occurred.

Detecting Cavities Before They’re Visible

Traditional cavity detection relies on visual inspection, probing with dental instruments, and X-rays. These methods work, but they’re somewhat subjective and tend to catch cavities only after they’ve progressed beyond the earliest stages. Newer technologies can detect demineralization before a cavity actually forms. Laser fluorescence devices, for example, shine infrared light on the tooth and measure the fluorescence that bounces back. Changes in the mineral structure or the presence of bacterial byproducts alter the fluorescence signal, giving a numerical score that indicates whether a lesion is developing. This allows dentists to identify at-risk areas and intervene with fluoride or sealants before a filling becomes necessary.