Generally speaking, cavities require three things: teeth, bacteria, and sugar. A cavity begins when dental plaque (which is a mixture of food debris, bacteria, and saliva) sticks to the surface of a tooth. In the presence of sugar, the bacteria found in dental plaque produce acid that begins to break down the tooth. If enough breakdown of the tooth occurs, a cavity develops.
You can prevent cavities, or decrease your risk of developing cavities, by reducing the amount of cavity-forming bacteria in your mouth and curtailing your sugar intake. Brushing twice per day and flossing daily disrupts the dental plaque that forms on your teeth and reduces the amount of bacteria present. In addition, fluoride found in toothpaste creates a stronger enamel surface that slows tooth breakdown. Finally, eating foods that are lower in sugar—and cutting back even on lower-sugar foods—will reduce your risk of developing cavities.