Vaccines work by introducing a harmless part of a virus or bacteria—such as weakened microbes, inactive microbes, or only their proteins—into the body. This triggers the immune system to recognize the invader and produce antibodies. These antibodies remain in the system and help the body respond faster if the real infection appears.
This process is similar to training the immune system so it can fight stronger future infections without the person becoming seriously ill.