A cavity forms when bacteria on your teeth produce acid that slowly dissolves the hard outer layer of a tooth. This process can take months to years, and it happens in distinct stages, starting as an invisible chemical change on the enamel surface and potentially progressing deep into the tooth’s inner layers. Understanding how this works helps explain why cavities sometimes hurt, why they get worse over time, and why early ones can actually be reversed.
How Bacteria Turn Sugar Into Acid
Your mouth is home to hundreds of bacterial species, but a few are especially good at causing cavities. These bacteria live in a sticky film called plaque that clings to tooth surfaces, particularly in grooves, between teeth, and along the gumline. When you eat or drink something containing sugar or starch, these bacteria absorb the carbohydrates and ferment them through the same basic metabolic process that turns milk into yogurt. The primary waste product is lactic acid.
The acid doesn’t just float around your mouth. It gets trapped between the plaque layer and the tooth surface, creating a concentrated pocket of acidity right where it can do the most damage. Within minutes of eating something sugary, the pH at the tooth surface can drop well below the safety threshold. It stays low for 20 to 30 minutes before your saliva gradually neutralizes it. Every snack or sugary drink resets that clock.
What Acid Does to Tooth Enamel
Enamel is the hardest tissue in the human body, made up of about 96% tightly packed mineral crystals called hydroxyapatite. Despite that strength, these crystals have a weakness: they dissolve in acid. When the pH at the tooth surface drops below about 5.5, the mineral crystals begin breaking apart in a process called demineralization. Calcium and phosphate ions leach out of the enamel and into the surrounding fluid.
This doesn’t create an instant hole. At first, demineralization happens beneath the surface while the outer layer of enamel remains relatively intact. The result is a white, chalky patch called a white spot lesion, which is the earliest visible sign of a cavity forming. At this stage, the damage is entirely reversible. Your saliva carries dissolved calcium and phosphate that can redeposit into the weakened enamel, essentially patching the damage. Fluoride accelerates this repair process by helping form a mineral called fluorapatite, which is more resistant to acid than the original enamel.
A cavity only becomes permanent when acid attacks outpace this natural repair cycle. If plaque stays on the tooth, if sugar exposure is frequent, or if saliva flow is low, the balance tips toward destruction. The weakened enamel surface eventually becomes rough and porous, then develops tiny micro-cavities, and finally collapses into a visible hole. Research suggests that this progression through the enamel layer alone takes an average of three to four years, though poor oral hygiene or a high-sugar diet can speed things up significantly.
What Happens When Decay Reaches Deeper Layers
Beneath the enamel sits dentin, a softer, yellowish tissue that makes up the bulk of the tooth. Dentin is more vulnerable to acid than enamel because it starts dissolving at a higher pH (around 6.0 to 6.4 compared to enamel’s 5.5). Once decay breaks through the enamel, it tends to spread faster through dentin.
Dentin is also structurally different from enamel in a way that matters. It’s laced with thousands of microscopic tubes called dentinal tubules that run from the outer surface all the way inward toward the tooth’s nerve center, the pulp. These tubules are filled with fluid, and they’re the reason cavities start to hurt. When a cavity exposes the tubules, things like cold drinks, sweet foods, or even a breath of air can cause the fluid inside them to shift. That movement triggers nerve endings at the inner end of the tubules, producing the sharp, sudden sting you feel when eating ice cream with a bad tooth.
The tooth tries to defend itself. Specialized cells lining the inner wall of the dentin produce new layers of protective material to wall off the advancing decay and shield the pulp. But if the decay moves faster than the tooth can build its barrier, bacteria eventually reach the pulp chamber itself.
When a Cavity Reaches the Nerve
The pulp is the living core of the tooth, containing blood vessels, connective tissue, and nerve fibers. Once bacteria invade this space, the immune response triggers inflammation and swelling. But because the pulp is enclosed inside a rigid tooth, swelling has nowhere to go. The pressure builds against the inner walls, compressing the nerve and producing intense, throbbing pain that can be constant rather than triggered by food or temperature.
At this point the infection can track down through the root canal and into the jawbone, forming a pocket of pus called an abscess. An abscess typically causes severe pain, swelling in the face or jaw, and sometimes fever. Left untreated, the infection can spread into deeper tissues of the neck or, in rare but serious cases, upward into the sinuses or bloodstream. These complications are uncommon with modern dental care, but they illustrate why a cavity isn’t just a cosmetic issue.
Why Some Cavities Hurt and Others Don’t
One of the most confusing things about cavities is that many of them cause no pain at all, especially in the early and middle stages. Enamel has no nerve supply whatsoever, so a cavity confined to enamel is completely painless. Even once decay enters the dentin, sensitivity depends on whether the tubules are open and exposed or partially sealed by mineral deposits and repair tissue. Plenty of people discover cavities only during a dental exam, sometimes after the decay is already extensive.
The type of pain also changes with the depth of decay. Shallow dentin cavities tend to produce brief, sharp pain in response to specific triggers like sweets or cold. Deeper cavities that approach the pulp may cause lingering pain that doesn’t go away when the trigger is removed. And once the pulp is infected, the pain often becomes spontaneous, waking you up at night or throbbing without any obvious cause.
How Dentists Classify Cavities
Dentists use a standardized scale from 0 to 6 to rate how far a cavity has progressed. A score of 0 means the tooth surface is healthy. Scores of 1 and 2 represent early enamel changes, the white spot stage, where remineralization is still possible without drilling. A score of 3 means the enamel surface has broken down but dentin isn’t visibly involved yet. At 4, a dark shadow from decayed dentin shows through the remaining enamel. Scores of 5 and 6 describe open cavities with visible dentin exposure, with 6 being the most extensive.
This scale matters because it determines treatment. Early-stage cavities (1 and 2) can often be managed with fluoride treatments, better brushing habits, and dietary changes. Once a physical hole forms, a filling is needed to restore the tooth’s structure. Deep cavities approaching or involving the pulp may require a root canal to remove the infected tissue. The further along the scale, the more invasive and expensive the treatment.
What Tips the Balance Toward Decay
A cavity isn’t caused by a single event. It’s the result of a long-running imbalance between acid attacks and your mouth’s natural repair system. Several factors tilt that balance toward decay:
- Frequent sugar or starch exposure: Every time you eat or drink something fermentable, bacteria produce acid for roughly 20 to 30 minutes. Sipping soda throughout the day is far more damaging than drinking one with a meal because it keeps the acid level elevated.
- Plaque buildup: Plaque traps acid against the tooth surface. Regular brushing and flossing physically remove this layer before it can do sustained damage.
- Low saliva flow: Saliva is the mouth’s primary defense, neutralizing acid and delivering the calcium and phosphate needed for remineralization. Dry mouth from medications, medical conditions, or mouth breathing reduces this protection significantly.
- Lack of fluoride: Fluoride from toothpaste and treated water helps rebuild weakened enamel with a more acid-resistant mineral. Without it, the repair process is slower and less effective.
Because cavities develop over months to years, small daily habits compound over time. The same process that makes them slow to form also means early damage can be caught and reversed before it becomes permanent, which is the main reason regular dental checkups matter even when nothing hurts.

