Four things are necessary for cavities to form -- a tooth, bacteria, sugars or other carbohydrates and time. Dental plaque is a thin, sticky, colorless deposit of bacteria that constantly forms on everyone's teeth. When you eat, the sugars in your food cause the bacteria in plaque to produce acids that attack the tooth enamel. With time and repeated acid attacks, the enamel breaks down and a cavity forms.