UCSF Black Health Initiative partners with the San Francisco African American Faith-Based Coalition.

The science behind COVID-19 vaccines rests on decades of research. Gladstone virologists help break down exactly how vaccines work, and how COVID-19 vaccines compare to other vaccines. Photo: Barbara Ries/UCSF


Over the course of 2020, the world watched with bated breath as biotechnology companies—in less than one full year—developed, tested, and released vaccines against the SARS-CoV-2 virus that causes COVID-19.

In some ways, these vaccines upended the paradigm of vaccines that came before; they were deployed on a faster timeline and it was the first time mRNA vaccines were used and mass-produced. But the science behind all COVID-19 vaccines rests on decades of research on infectious diseases, the human immune system, and vaccination. 

So how exactly do vaccines work, and how do COVID-19 vaccines compare to other vaccines? Let’s break it down.

What Is a Vaccine?

A vaccine is a compound that teaches your body’s immune system to recognize—and defend against—disease-causing cells and molecules.

Most vaccines train the immune system to identify bacteria and viruses, or the molecules produced by these pathogens. Today, however, vaccines also exist to help the human immune system seek out and destroy cancer cells.

“Vaccines can prime the body to recognize particular proteins in a handful of different ways,” says Nadia Roan, PhD, an associate investigator at Gladstone. “But the underlying idea behind them all is the same.”

How Does the Immune System Fight Germs without a Vaccine?

To explain how vaccines work, it helps to back up and explain how the human body usually handles germs. When a pathogen enters a person’s body, the broad-acting innate immune system is the first line of defense. White blood cells belonging to the innate immune system destroy germs and activate more targeted second and third lines of defense to help.

After being called to action, these more specific immune cells—collectively called the adaptive immune system—multiply, and some of them stick around even after an infection has cleared. These memory B cells and memory T cells patrol the body, on alert for a reappearance of the same germ. This means the next time the person is exposed to that pathogen, the adaptive immune system can react much faster, destroying the bacteria or virus before it has a chance to cause illness.

Infographic explaining how the immune system fights germs

After a pathogen enters the body, the first line of defense is the innate immune system, which then activate more targeted second and third lines of defense to help.

If you imagine the immune system like a castle’s defense, the cells of the innate immune system could be young squires playing outside the castle. They keep an eye out for enemies and, if they spot some strangers, wave their swords and alert the knights inside. The knights take some time to suit up in armor before they join the fight.

During the delay, the battle gets messy; squires are wounded and intruders sneak into the castle. After the battle is eventually won, the knights—the adaptive immune system in our metaphor—have learned their lesson. They set up trained guards on the castle walls to quickly recognize the would-be-intruders when they return.

How Do Vaccines Work?

The goal of a vaccine is to teach the adaptive immune system to recognize a foreign cell without that initial infection that makes us sick. In our castle metaphor, this means training the castle knights to spot intruders they’ve never encountered before.

In all vaccines, the body is exposed—through a shot, pill, dropper, or spray—to some piece or version of a pathogen that can’t cause disease. That piece is called an antigen.

There’s another component too; if you send unarmed intruders to mill around a castle, knights may not recognize them as threats. They—and the adaptive immune system—need instructions to know when to sound the alarm.

“One of the keys to making vaccines really effective is that molecules often have to be accompanied by a danger signal, called an adjuvant” says Roan. “This helps tell the immune system to pay attention.”

So, a vaccine is most often an adjuvant paired with an antigen.

What Are the Different Kinds of Vaccines?

The main way vaccines differ is in the type of antigen they use. Some vaccines include an entire, inactivated virus. Others use only one small protein from a pathogen—just enough for the adaptive immune system to learn to recognize it. Here are some of the main types of vaccines.

Infographic explaining the different types of vaccines

Some vaccines include a complete, inactivated virus, while others use only one small protein from a pathogen.

Live, Attenuated Vaccines

These vaccines use a weakened form of a germ that doesn’t usually make people sick. For our knights, this would be like teaching them to recognize intruders by bringing in a group of captive enemies without their swords.

“Attenuated viruses can infect cells, but they don’t cause disease and just kind of peter out,” says Roan. “Still, attenuated viruses could revert to a more virulent form over time. So, we don’t use these for some, more dangerous viruses because it’s considered too risky.”

Live vaccines are commonly used against measles, mumps, rubella, rotavirus, and chickenpox, among other things.

Inactivated Vaccines

Inactivated vaccines use a killed version of a pathogen. Inactivated vaccines include vaccines against hepatitis A, influenza, and rabies, as well as the COVID-19 vaccines produced by the Chinese companies Sinopharm and Sinovac.

“These really just contain the corpse of a virus,” says Roan. “They’re not at all capable of infecting cells.”

In the castle metaphor, it would be like teaching knights to recognize the enemy by showing them the bodies of dead intruders.

Toxoid Vaccines

In some cases, the real danger is not the intruders themselves, but the landmines they leave in their wake. The knights can to be trained to recognize those too, so as to quickly spot and defuse them in the future. This is the principle of toxoid vaccines, which contain a toxin produced by a virus or bacteria, rather than the germ itself. Diphtheria and tetanus vaccines are toxoid vaccines.

After exposure to one of these vaccines, the adaptive immune system won’t recognize the diphtheria- or tetanus-causing bacteria itself, but it will recognize—and destroy—any toxins the bacteria produce before they can cause illness.

“The general goal of most vaccines is actually not to prevent infection, but rather to prevent you from getting sick.”

Warner Greene, MD, PhD

Subunit Vaccines

Not all viruses produce unique toxins, but all viruses are made of a plethora of molecules that aren’t found in the human body. If the adaptive immune system can recognize just one of these, it can launch an attack against the virus.

Subunit vaccines expose the immune system to just one or a few proteins from a virus. This is analogous to teaching our knights to recognize intruders by showing them pieces of the intruders’ armor. Common vaccines against hepatitis B, human papillomavirus (HPV), whooping cough, and shingles are subunit vaccines.

Thanks to modern genetic engineering, it is possible to mass-produce the individual viral proteins that make up subunit vaccines, which is considered a safer approach than growing large amounts of virus for attenuated or inactivated vaccines.

mRNA Vaccines

Rather than including a virus or piece of a virus itself, mRNA vaccines contain genetic instructions—in the form of mRNA, which stands for messenger RNA—to make a piece of a virus.

“This means that our own cells can produce the viral proteins, and then those proteins are sensed by the immune system,” says Roan.

Like subunit vaccines, the viral proteins produced by mRNA vaccines are not toxic and cannot cause disease.

Scientists have been experimenting with mRNA vaccines for several decades, mostly to find ways of protecting the fragile mRNA molecules from destruction in the blood and in cells. The technology was perfected during the first coronavirus epidemics (SARS and MERS), but the vaccines were not used because these epidemics subsided rapidly. When SARS-CoV-2 came along, scientists modified the RNA in the vaccine to match the new coronavirus.

In our metaphorical castle, an mRNA vaccine is like providing the castle with an instruction manual for making a piece of the enemy’s armor. Once the castle blacksmiths produce a number of pieces from those instructions, knights can examine them and learn to recognize them in the future.

UCSF contractor vaccinates a patient at a drive-through pop up community vaccination site

COVID-19 vaccines include both mRNA vaccines (Pfizer-BioNTech and Moderna) as well as viral vector vaccines (Novavax and Johnson & Johnson). Photo: Mike Kai Chen/UCSF

The Pfizer-BioNTech (Comirnaty) and Moderna (Spikevax) COVID-19 vaccines are mRNA vaccines. They both include the mRNA instructions for a spike protein found on the surface of the SARS-CoV-2 virus.

One advantage of mRNA vaccines over subunit vaccines is that it is easier to mass-produce mRNA than a viral protein with good antigenic properties. However, mRNA is only stable at cold temperatures, so the transportation and storage of mRNA vaccines has to be carefully controlled, which can make distributing them challenging, particularly to resource-limited settings.

Viral Vector Vaccines

Like mRNA vaccines, viral vector vaccines deliver the instructions for a viral subunit rather than the subunit itself. But while mRNA vaccines contain those instructions in the form of a strand of mRNA, viral vector vaccines have a strand of DNA encased inside a harmless virus that can deliver the instructions into a cell.

For the cells to produce the viral protein, however, the DNA must first be turned into mRNA; this means viral vector vaccines require cells to take an additional step before the viral subunit is ready for the adaptive immune system.

The Novavax and Johnson & Johnson COVID-19 vaccines are viral vector vaccines (sometimes also called adenovirus vaccines). They both use harmless versions of viruses that cause common colds to carry the DNA for the SARS-CoV-2 spike protein.

“The mRNA and adenovirus vaccines are two different ways of getting the blueprint for the viral protein into our cells,” says Roan.

In the castle, a viral vector vaccine might mean that neutral soldiers show up at the castle gates to deliver instructions for producing enemy armor. But the instructions are in another language; they must be translated before being distributed to blacksmiths for production.

“The adenovirus viral vectors have both advantages and drawbacks when compared to mRNA vaccines for COVID-19,” says Melanie Ott, MD, PhD, director of the Gladstone Institute of Virology. “On one hand, viral vector vaccines are rugged ‘engines’ that can withstand greater changes in temperature than mRNA vaccines can, making them easier to store and distribute. But on the other hand, they are more complicated to produce than mRNA vaccines, and some contained a less immunogenic spike protein, which led to less protection.”

What Happens in the Body after an mRNA Vaccine Injection?

Current mRNA vaccines against COVID-19 are given as an intramuscular injection—a shot in your upper arm. After the injection, the strands of mRNA contained in the vaccine are taken up by cells in the arm muscle. The cells translate the mRNA into a protein—the SARS-CoV-2 spike protein—which they then release into the body.

Matthew McGregor working in the Roan Lab at Gladstone Institutes

Scientists around the world continue to work to better understand how the human immune system responds to different types of vaccines with the goal of improving their efficacy. Shown here is Matthew McGregor working in the Roan Lab at Gladstone.

The mRNA in the vaccine doesn’t change your DNA or stick around in your cells long-term. Within a few days, enzymes inside the cells will have destroyed the fragile strands of mRNA and the muscle cells will stop making the viral spike protein.

As the spike protein circulates in the body, the innate immune system recognizes it as foreign, starts fighting the protein and the cells that produce it, and alerts the adaptive immune system. This process happens gradually, and it takes a few weeks for the adaptive immune system to learn to recognize the spike protein and build a garrison of memory B and T cells against it.

In all, although mRNA vaccines are a novel type of vaccines, they are based on tried-and-true principles of cell biology and immunology.

“We understand mRNA very well,” says Roan. “And in general, the whole response to vaccines is basic immunology that has been very well established and is well understood. This is all about eliciting memory B cells and memory T cells against an antigen.”

Why Are Some Vaccines Oral, Others Nasal, and Others Given as a Shot?

While the immune system stretches from our heads to our toes, many immune reactions are very localized; when you get a cut on your thumb, the soreness and swelling is usually limited to your thumb. Similarly, when a virus enters the body through our throat or lungs, levels of memory T cells and memory B cells remain highest in those areas compared to elsewhere in the body—an ideal post for these cells to prevent future intrusions by the same virus.

That’s why scientists are working to develop vaccines that concentrate the immune response at the sites of pathogen entry. And some vaccines of this type already exist, though they are still rare.

For instance, the rotavirus vaccine given to babies and children is an oral vaccine; rotavirus causes inflammation of the stomach and intestines, and the vaccine is most effective when it spurs immunity in those organs. Today, the only nasal vaccine approved by the US Food and Drug Administration (FDA) is for the flu (FluMist), but many researchers think COVID-19 would be an ideal candidate for a nasal vaccine.

“The current COVID-19 vaccines are designed to elicit robust systemic immunity throughout the body,” says Roan. “But in the long-term, it seems like the levels of antibodies in the respiratory tract where we encounter SARS-CoV-2 aren’t staying high enough to prevent the virus from establishing infection there.”

So, whereas injected COVID-19 vaccines protect us well from disease, a nasal vaccine might have the added advantage of better preventing infection, and perhaps limiting transmission as well.

What’s the Ultimate Goal of Vaccination Programs?

Even the most highly trained knights can’t always prevent intruders from finding new ways to sneak into a castle. But they can prevent a castle from being completely overrun.

Similarly, not all vaccines can prevent pathogens from entering the cells of our bodies and making us sick. In fact, many symptoms of a viral infection are the side effects of our immune systems fighting the pathogen. Vaccines can reduce the risk of severe disease and hospitalization by stemming the intrusion before it triggers an overblown immune reaction.

“People often think vaccines are meant to prevent infection, but almost no vaccine completely blocks infection,” says Warner Greene, MD, PhD, director of the Michael Hulton Center for HIV Cure Research. “For example, if you’re vaccinated against polio and then exposed to the virus, polio still gets into your gut and infects cells. But then your immune system intercepts it before it gets to your spinal cord. The general goal of most vaccines is actually not to prevent infection, but rather to prevent you from getting sick.”

UCSF Black Health Initiative partners with the San Francisco African American Faith-Based Coalition.

Decades of research have shown that vaccines are a safe and effective way of protecting populations from severe diseases. Photo: Barbara Ries/UCSF

The reason people assume vaccination prevents infection might be that most of the population has been vaccinated against common pathogens, such as measles and polio, for several generations. As a result, few of these pathogens are in circulation, and the chances that a vaccinated person will suffer a breakthrough infection are very low.

But pathogens like the flu (which mutates rapidly) or SARS-CoV-2 (which is widespread and highly transmissible) are not as easily contained by vaccination.

“It would be great if we had a vaccine that would prevent infection for a long time, but so far that is not the case,” says Greene. “Instead, what we need most urgently are vaccines that prevent severe disease.”

How Long Do Vaccines Last?

Studies have shown that memory B cells and memory T cells, including those generated by vaccination, can last for multiple decades. However, this isn’t the case for every pathogen and every virus. In some instances, immunity fades over a few months or years—this is why some vaccinations require regular boosters.

It is now clear that the mRNA vaccines against COVID-19 result in antibodies that only last a few months, but the slower acting memory B cells and T cells remain and prevent the emergence of serious disease in vaccinated people who become infected.

“Right now, we just don’t know how long the immune response against SARS-CoV-2 will last,” says Greene. “It could be a few years or many years. There’s no way to find out other than waiting to see.”

Still, a century of experience with vaccination shows that vaccines are a safe and effective way of protecting populations from severe diseases.

“Before COVID-19, vaccine research had already produced an amazing array of vaccines and knowledge about infectious diseases and immunology,” says Ott. “This pandemic has reinvigorated research into vaccines, and we should see a lot of progress in the types of vaccines we can make and in their efficacy over the next few years.”

Featured Experts

Support Discovery Science

Your gift to Gladstone will allow our researchers to pursue high-quality science, focus on disease, and train the next generation of scientific thought leaders.

Donate Now