The primary cause of cavities is tooth decay. This occurs when acids produced by bacteria in your mouth damage the hard surface of your teeth. These bacteria feed on sugars and starches from food and drinks, producing acids that erode tooth enamel and form tiny holes, or cavities.