There are 2 main ways to prevent HPV infection. The first way to prevent HPV infection is through consistent condom use. The second way to prevent HPV is through vaccination. The Gardasil vaccine is readily available and can be given to both men and women ages 9-26. It is most effective when given prior to beginning sexual activity. It is recommended that girls aged 11-12 years old are vaccinated; however, you may be vaccinated up until age 26 and still receive some benefits.