Vaccinations can prevent certain types of cancers caused by viruses. For instance, the human papillomavirus (HPV) vaccine can prevent cervical and other types of cancer, while the hepatitis B vaccine can reduce the risk of liver cancer. Getting vaccinated as recommended by healthcare providers can be a powerful tool in cancer prevention.