Preventing cavities involves maintaining good oral hygiene practices, such as brushing twice a day with fluoride toothpaste, flossing daily, eating a balanced diet low in sugary foods and drinks, and visiting your dentist regularly for check-ups and cleanings. Using dental sealants and fluoride treatments can also help protect your teeth.