How Vaccines Work

Your immune system protects your body from infections (and other harmful things).

There are two ways to develop immunity against an infection.

One is to get the infection.

The other is to get a vaccine.

When your immune system meets a virus for the first time, it doesn’t start fighting right away.

It takes a few days for it to learn to recognize the virus and ramp up a strong response.

Meanwhile, the virus has time to reproduce and spread. It starts to damage your body, and you feel sick.

By the time your immune system gets up to speed and starts to fight back, it has a more serious infection to deal with.

You might feel sick for a while.

But the immune system has something like memory.

After you get better, a few of the immune cells that helped to fight the infection hang out in your body.

If the same virus ever comes back, these immune cells very quickly recognize it and get ready to fight it again.

They’ll start fighting back before the virus can do much damage.

A vaccine acts like a first exposure: it mimics an infection.

Just like with an infection, your immune system responds.

But a vaccine is safer than getting the virus. It teaches your immune system without making you sick.

Afterward, a few immune cells hang out and wait for the virus to appear.

That way, if you meet the real virus, your immune system can start fighting right away. Before it can make you sick.

This page is all about viruses, but the same ideas apply to infections caused by bacteria and other parasites.

Most vaccines in use today are made from whole viruses or parts of viruses. To learn more, visit Types of Vaccines.

Immunity Is Specific to the Virus

Each type of virus has different proteins. Your immune system recognizes a virus by the proteins it has on its surface. So having measles or a measles vaccine won’t protect you against the flu or polio, for example. And a vaccine against one strain of flu may not protect you from another strain.

Vaccination Works — But it Is Not a Guarantee

If you get a vaccine, there’s still a chance you could get the virus. But this is true with natural infections too! People can get infected twice with the same virus.

A vaccine’s efficacy rate tells you how well a vaccine protects you from infection. It’s measured by comparing how many people got sick after having the vaccine vs. those who didn’t get vaccinated. Most vaccines are 90+% effective. Some are lower. The flu vaccine, for example, is usually between 40 and 60% effective. This rate is lower than most in part because a lot of people who get the flu vaccine are older. As you age, your immune system doesn’t work as well. It’s also because the flu is complicated. There are lots of strains going around, and they change with each season. But that doesn’t mean you should skip the vaccine! You can think of it like a seat belt: it’s not guaranteed to save you from injury, but it improves your chances.

Even a partially effective flu vaccine saves thousands of lives each year in the US. Plus, even if you get infected after having the vaccine, the symptoms are most often mild. That’s because a vaccine can sometimes give partial protection. Immunity isn’t like a binary, on/off switch. It’s more like a dimmer.


Bloom, B. R., & Lambert, P.-H. (2016). The Vaccine Book (2nd ed.). San Diego: Elsevier Science & Technology.

Center for Disease Control and Prevention. Vaccine Effectiveness: How Well Do the Flu Vaccines Work? Retrieved October 29, 2020.

Foppa, I. M., Cheng, P. Y., Reynolds, S. B., Shay, D. K., Carias, C., Bresee, J. S., ... & Fry, A. M. (2015). Deaths averted by influenza vaccination in the US during the seasons 2005/06 through 2013/14. Vaccine, 33(26), 3003-3009.