Skip to main content
Cancer Explained
Donate
Intermediate 6 min readSource checked

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

Five smiling adults with backpacks hike along a grassy mountain trail under a wide cloudy sky.
Group Hike Together

Key fact

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

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 understand this

The full explanation.

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

The vaccine works best when given before someone is exposed to the virus. That is why it is recommended for preteens. It can also be given to older teens and young adults, and in some cases up to age 45 after a conversation with a doctor.

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. This vaccine is a routine part of childhood immunization in many places, and it is also recommended for certain adults.

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 and are considered safe and effective by health agencies like the CDC. As with any vaccine, some people have mild side effects, such as a sore arm or feeling tired for a day.

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 for life.

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

Words to know

Tap any term to see what it means.

Browse the full glossary →

A woman in headscarf sits alone by a window inside a home, looking pensive

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 widely studied and are considered safe and effective by health agencies like the CDC. As with any vaccine, some people have mild side effects like a sore arm. Your care team can answer specific questions.

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).

Human Connection Layer

Speak With Trained Specialists & Human Navigators

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

Immediate emergency guidance for fever (>100.4°F during chemo), severe pain, or shortness of breath.

Help Us Improve This Guide

Did this explanation answer your question and help you determine your next step?

Know someone who needs this?

Plenty of people are looking for something like this and do not know where to start. If this would help a friend or someone you love, send it on — we have written an opening line so you do not have to stare at an empty message. You can change every word of it.

Email itText itWhatsApp

Your message is written and sent in your own email or messaging app — we never see who you send it to, and nothing is added to any list.

Knowledge Check

0 of 4 answered

  1. Q1.According to this article, how do preventive cancer vaccines work?
  2. Q2.According to this article, which cancer does the hepatitis B vaccine help prevent?
  3. Q3.According to this article, what is the difference between preventive and treatment vaccines?
  4. Q4.According to this article, does the HPV vaccine replace cervical cancer screening?

This self-assessment checks understanding of educational content only. It is not medical advice.

Plain-language explanation of the published sources cited on this page. AI-assisted, source-checked, not clinician-reviewed.

Last updated: 2026-08-18Next planned review: 2027-07-04

How this page was created

Cancer Explained does not originate medical claims. Every page restates guidance already published by the National Cancer Institute, the CDC, the USPSTF and the FDA, in plain language, with the source cited so you can check the original yourself. AI does the translating and organizing; automated checks test claims, citations, clarity and safety before anything publishes. We do not employ clinicians and do not intend to — our work is translation and navigation, not clinical judgment. Nothing here is personal medical advice, and no page can account for your particular situation.

Editorial status — Source checked. This page was written with AI assistance and checked line by line against the sources listed on it. That confirms the sources support what the page says. It is not a medical review, and it does not confirm the page is complete or right for your situation.

General education — varies by person. Answers genuinely differ between people. This page explains what commonly varies and points you to your care team for your situation.

Human medical review: not completed. Pages here are not signed off by a clinician before they publish. That is not an oversight we are quietly working around: we restate published guidance and cite it, so the authority belongs to the source rather than to us, and every page names where its claims come from — you can verify us instead of trusting us. Where a volunteer clinician has reviewed a page, their name and credentials appear on it; where no name appears, no clinician has checked it. We are glad to have reviewers and are recruiting them, and we do not hold pages back waiting for one. Use this site to understand your situation and to ask better questions of the people treating you.

Our editorial processHow we use AIReport an error

How this page was created

Cancer Explained does not originate medical claims. Every page restates guidance already published by the National Cancer Institute, the CDC, the USPSTF and the FDA, in plain language, with the source cited so you can check the original yourself. AI does the translating and organizing; automated checks test claims, citations, clarity and safety before anything publishes. We do not employ clinicians and do not intend to — our work is translation and navigation, not clinical judgment. Nothing here is personal medical advice, and no page can account for your particular situation.

Editorial status: Source checked This page was written with AI assistance and checked line by line against the sources listed on it. That confirms the sources support what the page says. It is not a medical review, and it does not confirm the page is complete or right for your situation.

Human medical review: not completed. Pages here are not signed off by a clinician before they publish. That is not an oversight we are quietly working around: we restate published guidance and cite it, so the authority belongs to the source rather than to us, and every page names where its claims come from — you can verify us instead of trusting us. Where a volunteer clinician has reviewed a page, their name and credentials appear on it; where no name appears, no clinician has checked it. We are glad to have reviewers and are recruiting them, and we do not hold pages back waiting for one. Use this site to understand your situation and to ask better questions of the people treating you.

Read more about our editorial process, our use of AI, and our corrections policy.

Spotted a problem? Report an error — a factual mistake, broken or outdated source, confusing wording, or anything that seems unsafe. Please do not include names, medical record numbers, dates of birth, addresses, or other identifying medical information in your report.

After using this page, do you understand what to do next?

Anonymous — we only record the answer, never who gave it.