There are many different ways that researchers can create a vaccine. Here are two great YouTube videos that I found that can probably give you a better explanation than I can. And they use the current coronavirus as an example.
Vaccines can be made in a few different ways (see below), but what they all have in common is that the original virus or bacteria is attenuated (scientific word for weakened to the point of NOT being dangerous) so that it cannot reproduce (make more of itself). When the vaccine is given to someone, it allows their body to create special immune system proteins called antibodies, that specifically recognise that virus or bacterium and allow us to react to the real thing better than if we didn’t have the vaccine.
Examples: One way to make a vaccine for a virus is to change the viral genes so that the virus replicates poorly. This is how the measles, mumps, rubella, and varicella vaccines are made.
Another way is to remove the viral genes completely so that the virus can’t replicate at all. This is how the polio vaccine is made. A third way is to use only a part of the virus or bacteria. This is how the hepatitis B vaccine is made. A fourth way specifically for bacteria is using a toxin that kills the bacteria so it can’t do any harm, used for infections like diphtheria, tetanus, and pertussis (whooping cough).
Sorry, I’m not very familiar with this… vaccines usually contain attenuated virus/bacteria or components of the virus/bacteria, which trigger an immune response from the body without the dangers of having the real virus/bacteria. After this, the body will have the antibodies to fight off this kind of infection in the future. The videos posted by Sophie give an excellent explanation!
The video gives a great explanation!
I study Vaccinia virus. This virus was actually the first vaccine ever (hence the name)… a long time ago a british doctor realised that milk maids barely ever got sick from a very deadly virus called small pox… they had weird scabs on their hands as did the cows they milked on their legs. He thought ‘Maybe its because of the scabs’.. so he removed one from a cow.. made it into powder and injected a boy with it.. when the kid was exposed to the deadly virus a little later he did not get sick.
Those scabs where lesions of vaccinia virus.. that virus looks very similar to small pox but is not nearly as dangerous. So if your immune system sees vaccinia first it can learn and knows how to react when small pox comes along.
Smallpox is now completely extinct since the 1980s because back then everyone was vaccinated so the virus had nowhere else to go 😉