Skip to main content
Intermediate 6 min read

Cancer Vaccines for Prevention

A plain-language explainer on preventive cancer vaccines like HPV and hepatitis B, which stop infections that can lead to cancer

NCI source:National Cancer Institute — Risk Factors: Infectious Agents

Review status: AI-assisted, source checked. Not reviewed by a clinician. How we check pages

The short answer

Some vaccines help prevent cancer by stopping infections that can lead to it. The HPV vaccine prevents infections that cause cervical and several other cancers, and the hepatitis B vaccine prevents an infection that can cause liver cancer. These preventive vaccines are different from treatment vaccines, which are used in people who already have cancer.

  • Some vaccines prevent cancer by stopping infections that can lead to it.

  • The HPV vaccine prevents infections that cause cervical and several other cancers.

  • The hepatitis B vaccine prevents an infection that can cause liver cancer.

  • Preventive (prophylactic) vaccines are given before infection to healthy people.

Choose how you want to read this

The whole article, with every detail and caution.

The simple version

Most people think of vaccines as protection against illnesses like the flu. But a few vaccines also help prevent cancer.

They do this in a clever way. Some viruses can cause cancer over time. Vaccines that stop those infections can also stop the cancers they might have led to.

The HPV and hepatitis B vaccines are the two main examples of cancer-preventing vaccines.

How a vaccine can prevent cancer

Certain viruses are known to cause cancer. When a vaccine prevents one of these infections, it can prevent the cancer that infection might have caused years later.

This is an indirect but powerful approach. The vaccine does not attack cancer cells. Instead, it trains your immune system to stop the virus before it can take hold and cause harm.

Because these viruses often lead to cancer only after many years of infection, preventing the infection early can lower cancer risk far into the future.

Preventive vaccines versus treatment vaccines

It helps to know that "cancer vaccine" can mean two very different things:

  • Preventive (prophylactic) vaccines are given to healthy people before infection. Their goal is to stop a cancer-causing virus. The HPV and hepatitis B vaccines are this kind. This article is about them.
  • Treatment vaccines are given to people who already have cancer. Their goal is to help the immune system fight the existing cancer. These are part of cancer treatment, not prevention.

Keeping these two apart avoids a lot of confusion.

The HPV vaccine

HPV, or human papillomavirus, is a common virus. Certain types can cause cancer. The HPV vaccine protects against the types most likely to lead to cancer.

By preventing these infections, the vaccine helps prevent:

  • Cervical cancer
  • Some anal, throat, penile, vulvar, and vaginal cancers

It is recommended for preteens. In some cases it can be given up to age 45 after a conversation with a doctor. The section on timing below explains why age matters.

The hepatitis B vaccine

Hepatitis B is a virus that infects the liver. A long-term infection can, over many years, lead to liver cancer.

The hepatitis B vaccine prevents this infection. By doing so, it lowers the risk of liver cancer down the road. NCI notes that infants in the United States and most other countries are routinely vaccinated against it. CDC has long recommended it for all infants, for children and adolescents younger than 19 who have not been vaccinated, for adults 19 to 59, and for adults 60 and older with risk factors for hepatitis B. In December 2025, CDC changed its advice on the dose given at birth for babies whose mothers test negative for hepatitis B, making it an individual decision. Federal vaccine schedules have been in flux since then, so ask your clinician or your child's doctor about timing.

Vaccines and screening work together

Cancer-preventing vaccines are powerful, but they are not the whole story. They work best alongside screening.

For example, the HPV vaccine does not protect against every type of HPV that can cause cancer. So people should still follow cervical cancer screening guidelines even if they had the vaccine. Vaccines lower risk, and screening catches problems early. Together, they offer stronger protection than either alone.

Are they safe?

The HPV and hepatitis B vaccines have been studied widely. NCI reports the HPV vaccine has been monitored for over 20 years, and the most common problems are brief soreness and other local symptoms at the injection site.

If you have questions about whether you or your child is due for these vaccines, or whether they make sense at your age, your care team is the best guide. They can look at your history and help you decide.

Why timing matters

For preventive vaccines, timing makes a real difference. They work best when given before a person is exposed to the virus.

That is why the HPV vaccine is recommended for preteens, well before most people could be exposed. It can still be given to older teens and young adults, but the benefit is greatest earlier. Similarly, the hepatitis B vaccine is often given in childhood so protection is in place early.

This does not mean it is too late for everyone else. Depending on your situation, a vaccine may still be helpful. A conversation with your doctor can sort out what fits your age and history.

The bigger picture

Cancer-preventing vaccines are a good example of how science can stop some cancers before they start. By preventing the infections that cause them, these vaccines protect against several cancers at once, often for many years.

Getting recommended vaccines, staying up to date on screening, not smoking, and living healthy habits all work together to lower cancer risk. No single step covers everything, but each one adds protection. If you are unsure whether you or your family members are protected against HPV and hepatitis B, your care team can check your records and fill any gaps.

Sources

A clinician in navy scrubs and white gloves injects a young woman’s upper arm in a clinic room with an HPV vaccine poster and a seated person behind.

Common questions

How can a vaccine prevent cancer?

Some viruses can cause cancer. Vaccines that prevent those infections can, in turn, help prevent the cancers they lead to. The HPV and hepatitis B vaccines work this way. They do not target cancer cells directly; they stop the infection that could cause cancer later.

Which cancers can vaccines help prevent?

The HPV vaccine helps prevent cervical cancer and several other cancers linked to HPV, such as some anal, throat, penile, vulvar, and vaginal cancers. The hepatitis B vaccine helps prevent liver cancer by preventing long-term hepatitis B infection.

What is the difference between preventive and treatment vaccines?

Preventive vaccines are given to healthy people before infection to stop a virus that could cause cancer. Treatment vaccines are given to people who already have cancer, to help the immune system fight it. This article is about the preventive kind.

Who should get the HPV vaccine?

The HPV vaccine is recommended for preteens, and it can be given through the mid-20s and, in some cases, up to age 45 after talking with a doctor. It works best when given before someone is exposed to the virus. Your care team can advise on timing.

Do these vaccines replace cancer screening?

No. For example, people should still follow cervical cancer screening guidelines even if they had the HPV vaccine, because the vaccine does not protect against every type. Vaccines and screening work together to lower risk.

Are these vaccines safe?

The HPV and hepatitis B vaccines have been studied widely. NCI reports the HPV vaccine has been monitored for over 20 years, and the most common problems are brief soreness and other local symptoms at the injection site. Your care team can answer specific questions about either vaccine.

Questions to ask your doctor

Being prepared helps you get the most out of your appointments. Save or print these questions.

Open my question list

Tap a question to save it to your list (kept on this device).

Talk to a person

Talk with a trained specialist or navigator

Cancer Explained provides educational guidance, but does not replace trained specialists, social workers, or your medical team.

Free & Confidential

Talk to a trained cancer information specialist

Free, confidential assistance from NCI Cancer Information Service via phone, chat, or email.

Contact your oncology team

Locate after-hours contact numbers, portal messages, or urgent triage phone lines.

Find a patient navigator

Get one-on-one help with appointments, logistics, translation, and care coordination.

Find a genetic counselor

Discuss inherited mutation risk, family history, and genetic testing options.

Find an oncology social worker

Access emotional counseling, family support groups, and mental health resources.

Find a financial navigator

Locate copay assistance foundations, grant programs, and lodging/travel support.

Find a clinical-trial specialist

Search matching studies and speak with NCI trial information specialists.

Get urgent help

Severe trouble breathing, chest pain, or any other emergency: call 911 now. Fever of 100.4°F (38°C) or higher during chemo, or severe pain: call your cancer care team right away, day or night.

Call 911

Prepared by Cancer Explained's AI-assisted editorial system

Written from National Cancer Institute material and compared with the source cited below.