One of the most effective ways to prevent HPV infection is through vaccination. The HPV vaccine is recommended for preteens (boys and girls) aged 11 to 12, but it can be given as early as age 9 and up to age 26. The vaccine protects against the most common high-risk HPV types. Additionally, using condoms and having regular screenings (such as Pap smears for women) can help reduce the risk of HPV-related cancers.