Skip to main content
IDF logo
Child uses stethoscope on stuffed dog.

How your immune system works

Key points:

  • The immune system is a network of many different organs, cells, and proteins throughout the body that work together to protect against threats like germs.
  • The innate immune system includes all the immune system parts that don't need training, such as cytokines, natural killer (NK) cells, neutrophils, and monocytes/macrophages. Innate immune responses are not targeted to specific germs and include fever, inflammation, and swelling.
  • The adaptive immune system includes the parts of the immune system that 'learn' to target specific germs, such as B cells, antibodies, and T cells. 
  • Both the innate and adaptive immune systems are present from birth, but the adaptive immune system develops rapidly during childhood as it gains experience with different germs.
  • Different pieces of the innate and adaptive immune systems protect against specific kinds of germs like bacteria, fungi, or viruses.

The immune system is a defense network in your body made up of different organs, cells, and proteins that work together to protect you from threats like germs. Unlike other organs, such as the heart or liver, the immune system doesn’t have a single location; it’s spread throughout the body to quickly respond to infections wherever they are. Each part of the immune system has a specific job, helping to recognize and fight off different types of germs, including bacteria, viruses, fungi, and parasites.

To better understand immunodeficiencies, it’s important to know how the immune system works. There are two main types of immune responses: innate and adaptive.

Innate versus adaptive immune responses

Some immune system reactions to infections, like fever and swelling, are general. They don't target the specific germs causing the infection. These built-in immune reactions are called innate immune responses and are the body’s first line of defense. They are quick and reliable. Even newborn babies have strong innate immune responses. Cells and proteins that help with innate immune responses include cytokines, natural killer (NK) cells, neutrophils, and monocytes/macrophages. In addition, all of the cells in our bodies have some limited built-in ability to fight viruses.

Because they activate quickly, innate immune responses are usually the first to respond to germs. This first response triggers adaptive responses, which can take several days to get going. The cells and proteins involved in each type of response also communicate with each other, like different parts of an army communicating during battle.

Adaptive immune responses are the parts of the immune system that need training to find and target specific germs. Adaptive immune responses must also be trained to ignore the body’s own healthy cells. B cells and T cells (also called B and T lymphocytes), as well as proteins called antibodies (also called immunoglobulins or gamma globulins), make up the adaptive immune system. Bone marrow, the soft tissue inside bones, and the thymus, a small organ near the heart, are where B cells and T cells, respectively, learn to recognize germs and ignore healthy cells. When there are problems with this important training, the immune system can fail to recognize threats and can also fail to recognize healthy tissue.

Adaptive immune responses take longer to develop than innate responses but they last a long time. That’s because some of the B and T cells that spot a specific germ become keepers of that immune ‘memory’ after the infection is over. These ‘memory’ cells live a long time and help the adaptive immune system react to germs it has seen before more quickly and forcefully the next time.

Early in life, a person’s innate immune responses are the most active. The adaptive immune system works from birth, but it doesn’t have the experience to respond well to specific germs. The adaptive immune system gains the most experience with, and memory of, germs between birth and three years of age. However, it continues to form memory throughout a person’s life.

Newborn babies also don't make their own antibodies for several weeks. Instead, they rely on antibodies from their mothers. The mother’s antibodies are passed to the baby through the placenta, which is the organ that connects the baby’s and mother’s blood supplies. These maternal antibodies protect the baby until they can make enough antibodies on their own.

Over the first few years of life, children come into contact with many different kinds of germs. They start producing antibodies, B cells, and T cells against those specific germs. Because the adaptive immune system develops so quickly in early childhood, it is hard to test the immune system in young children. What is considered typical changes rapidly with age.

Major organs and tissues of the immune system

The thymus is an organ in the upper chest where T cells mature. Immature immune cells that will become T cells travel from the bone marrow to the thymus. There, they become trained, mature T cells. The thymus is also where T cells that recognize and might attack healthy tissue (auto-reactive T cells) get weeded out.

The liver is the main organ that makes complement proteins. It also has many special white blood cells, called Kupffer cells, that eat bacteria in the blood as it flows through the liver.

The bone marrow is the soft tissue at the center of bones. It contains hematopoietic stem cells (HSCs), which produce all of a person’s white blood cells, red blood cells, and platelets.

Tonsils are two oval-shaped, fleshy pads at the back of the throat, with one on each side of the tongue. They contain B and T cells. Tonsils help protect you from germs that you breathe in or swallow.

Lymph nodes are collections of B cells and T cells throughout the body. Cells gather in lymph nodes to communicate with each other. Lymph nodes can become swollen when you are fighting an infection.

The spleen is an organ found on the left side of your body, beneath your ribs and above your stomach. It contains B cells, T cells, and monocytes. The spleen cleans the blood and allows germs and immune system cells to interact.

Blood carries the cells and proteins of the immune system all over the body.

Cells and proteins of the immune system

All the cells of the immune system, known together as white blood cells or leukocytes, develop from the blood-forming hematopoietic stem cells (HSCs) that make up the bone marrow. HSCs also produce red blood cells and platelets.

To reach every part of the body, white blood cells travel through blood vessels and in specialized lymphatic vessels. Lymph nodes, located along lymphatic vessels, and the spleen provide places where the different cells of the immune system communicate with each other. The most common types of white blood cells are B cells, T cells, natural killer (NK) cells, neutrophils, and monocytes/macrophages.

The proteins important in the immune system are made by white blood cells or organs such as the liver. Some immune system proteins travel in the bloodstream, while others act on the organs and tissues near where the proteins are made. The major proteins of the immune system are antibodies, cytokines (including interferons), and complement proteins.

Hematopoietic stem cells inside bone marrow give rise to all of the white blood cells of the immune system, as well as red blood cells and platelets.

The main function of B cells is to make an important group of proteins called antibodies that recognize and physically attach, or bind, to germs. All together, B cells can produce a wide variety of antibodies against almost all germs. However, each individual B cell makes only one kind of antibody that recognizes only one specific type of germ, like a lock and key. For example, there are different antibodies, made by different B cells, that recognize chicken pox virus versus staph bacteria versus athlete’s foot fungus.

Importantly, B cells in the bloodstream become plasma cells, which are literally antibody factories that live mostly in the bone marrow but also in many tissues. One B cell makes one type of antibody and turns into a plasma cell that, in turn, makes large amounts of that same type of antibody.

There are also different classes and subclasses of antibodies that differ from each other in their chemical structure. The five classes of antibodies are immunoglobulin (Ig) M, IgG, IgA, IgE, and IgD. IgG also has four different subclasses (IgG1, IgG2, IgG3, IgG4) and IgA has two subclasses (IgA1 and IgA2). Each class and subclass has a specific function in the body.

  • IgM antibodies are the first class of antibodies B cells make and are important during the early days of an infection. IgM easily activates a group of immune system proteins called the complement system.
  • IgG antibodies make up the majority of antibodies in the blood. They last for a few weeks and travel from the bloodstream into tissues easily. They’re also found in bodily fluids and only IgG antibodies cross the placenta from a mother to the baby. Immunoglobulin (Ig) replacement therapy contains mostly IgG. There are four IgG subclasses:
    • IgG1: 60-70% of total IgG, protects against viruses and toxins from bacteria like diphtheria and tetanus.
    • IgG2: 20-30% of total IgG, protects against the sugar coating (polysaccharide capsule) of certain bacteria like Streptococcus pneumoniae and Haemophilus influenzae.
    • IgG3: 5-8% of total IgG, also protects against viruses and toxins from bacteria like diphtheria and tetanus.
    • IgG4: 1-3% IgG4, controls immune responses.
  • There are two subclasses of IgA antibodies, IgA1 and IgA2. IgA1 makes up about 80% of the IgA in the bloodstream. IgA1 and IgA2 in the bloodstream is called serum IgA and serum IgA is mostly single molecules. Both IgA1 and IgA2 in other bodily fluids like tears, bile, saliva, and mucus is called secretory IgA. There is a higher percentage of IgA2 in secretory IgA than in serum IgA. Secretory IgA is made up of two molecules joined together, which protects it from being broken down on mucous membranes and in bodily fluids. Secretory IgA protects mucous membranes in the respiratory and gastrointestinal tracts from germs.
  • IgD makes up a very small percentage of antibodies in the bloodstream. Most IgD is on the surface of B cells along with IgM, and it may play a role in helping B cells develop into plasma cells.
  • IgE antibodies protect against parasites and are also responsible for allergic reactions.
The structures of IgG, secretory IgA, and serum IgM antibodies.
Structures of IgG, secretory IgA, and IgM in the bloodstream. Light green shows the binding sites that recognize germs. Light grey shows the secretory piece that protects secretory IgA.

As part of their development in the bone marrow, B cells are tested to see if they make antibodies that could cause the immune system to attack healthy cells and tissues (autoantibodies). Any that do are weeded out. After developing, naïve B cells live in the bone marrow, lymph nodes, spleen, some areas of the intestines, and the bloodstream. These B cells make IgM and IgD and are called "naïve" because they haven’t yet come in contact with the germ their antibodies recognize.

  • IgD and some IgM antibodies are anchored as single molecules on the surface of the B cells that make them.
  • The other form of IgM is made up of five antibody molecules attached to each other in a ring and is found in the bloodstream.

After the IgM on a B cell comes in contact with the germ it recognizes, the B cell makes copies of itself. Some of the copies become long-lived memory B cells. Memory B cells form the ‘memory’ that allows for a fast, forceful response if the immune system sees the same germ again.

Other copies of the B cell ‘class switch’ to make other classes of antibodies, such as IgG or IgA, as they develop into plasma cells. However, regardless of the antibody class, the antibodies the plasma cells produce remain specific to the germ that was detected by the IgM on the original B cell.

Plasma cells are located in the spleen and lymph nodes throughout the body and pump out large amounts of antibodies, which end up in the bloodstream, tissues, mucus of the respiratory and gastrointestinal tracts, and other bodily fluids.

Sometimes, antibodies themselves prevent germs from causing an infection. For example, viruses must attach to and enter a person’s cells to multiply. Antibodies that bind to proteins on the surface of a virus can block it from entering cells and causing an infection.

In other cases, antibodies set off a chain of events involving other parts of the immune system that work to destroy the germ. Antibodies that recognize and attach to the surface of some types of bacteria activate the complement system, which then directly kills the bacteria. Antibody-coated bacteria are also much easier for white blood cells called neutrophils to eat and kill than uncoated bacteria. All of these actions prevent germs from successfully invading the body and causing infections.

T cells are a kind of white blood cell. Some T cells get rid of cells infected with viruses, while others help control how and when the immune system turns on or off.

T cells start developing from stem cells in the bone marrow but finish developing in the thymus, which is why they are called “T” cells. Without a thymus, a person cannot make working T cells, leading to severe immunodeficiency.

As T cells develop in the thymus, they cut out a small piece of DNA that forms a circle inside the cell. These are called T cell receptor excision circles (TRECs). The newborn screening test for severe combined immune deficiency (SCID) measures these TRECs. In the thymus, any T cells that might attack healthy body tissues (auto-reactive T cells) are also removed. When they are fully mature, naïve T cells leave the thymus and move throughout the body to places like the spleen, lymph nodes, bone marrow, and blood. They are called naïve T cells because they haven’t yet come in contact with germs.

T cells have proteins on their surfaces that detect substances outside of the cell. These are called T cell receptors. Similar to B cells and antibodies, each individual T cell makes only one kind of T cell receptor that recognizes only one specific type of germ. However, all of a person’s T cells together make so many different T cell receptors that the immune system can detect almost any possible germ.

There are different kinds of T cells with different jobs, including: 

  • Killer T cells (also called cytotoxic or CD8+ T cells). 
  • Helper T cells (CD4+ T cells). 
  • Regulatory T cells (Treg). 

Killer T cells destroy cells infected by viruses or certain types of bacteria. Killer T cells travel to where the infection is and attach directly to infected cells to destroy them. Like natural killer (NK) cells, killer T cells inject infected cells with chemicals called cytotoxic granules, which act like a poison.

When killer T cells are fighting infections, they make copies of themselves. Some of those copies go on to become memory T cells, which help the immune system launch a faster and more aggressive response to the germ if the immune system sees it again.

Killer T cells can also attack non-self tissues, like transplanted organs, leading to rejection. In hematopoietic stem cell transplantation (HSCT), a different problem called graft-versus-host disease (GVHD) can occur if killer T cells in the stem cell graft attack the recipient’s body. When GVHD risk is high—for example, when the donor is a half-matched parent—the transplant team may process the graft to remove donor T cells (T cell depletion) to help prevent GVHD.

Helper T cells work with other immune cells. They help B cells make antibodies and support killer T cells in fighting foreign substances.

Regulatory T cells act like a stop signal, turning off T cells and B cells. These regulatory T cells keep the immune response at just the right level—not too strong and not too weak. Without regulatory T cells, the immune system fights things that are harmless like our own organs and pollen.

Natural killer (NK) cells are part of the innate immune system and do not need the same training that B or T cells need. They are called natural killer cells because they easily kill cells infected by viruses and are always ready to respond. They come from the bone marrow and low numbers of them live in the blood and tissues.

Like killer T cells, NK cells inject cytotoxic granules into cells infected with viruses to kill them. NK cells are very important for defending against herpes viruses in particular. This group of viruses includes the cold sore virus (herpes simplex), the virus that causes mononucleosis (Epstein-Barr virus), and the virus that causes chickenpox and shingles (varicella virus). NK cells may also target cancer cells.

Neutrophils, also called polymorphonuclear leukocytes (PMNs), make up more than half of all the white blood cells in your blood. Like other white blood cells, they develop from stem cells in your bone marrow. They are part of the innate immune system and mainly protect against bacteria and fungi. They do not do much to protect you from viruses.

Neutrophils respond to chemical signals to quickly move to places in your body where there is a bacterial or fungal infection. When you get an infection, neutrophils are some of the first cells to leave your blood and move into the affected tissues. They are responsible for creating pus.

When you have an infection caused by bacteria or fungi, the number of neutrophils in your blood increases, which can make your white blood cell count high. Neutrophils mainly work by eating and killing bacteria or fungi. They swallow up the germs into special pockets inside the cell. These pockets have toxic chemicals like superoxide and hydrogen peroxide, known together as reactive oxygen species, that mix with the germs to kill them [1]. This process is called the oxidative burst. Neutrophils can also release reactive oxygen species into the nearby tissue.

Monocytes are a type of white blood cell similar to neutrophils. They travel in the bloodstream and make up 5-10% of your white blood cells. They also line the walls of blood vessels in organs like the liver and spleen, where they catch germs as blood passes by. When monocytes leave the bloodstream and move into the body's tissues, they change shape and size to become macrophages.

Macrophages are important for killing fungi and a type of bacteria called mycobacteria; tuberculosis is caused by a species of mycobacteria. Like neutrophils, macrophages eat germs and use toxic chemicals to directly kill the invader. Macrophages live longer than neutrophils and are very important for slow-growing or long-lasting infections. Macrophages communicate with T cells and often work with them to kill germs.

Sometimes, immune system cells communicate by touching each other directly. However, they often communicate by releasing cytokines. Cytokines are small proteins that help cells in the immune system communicate with each other, and can affect other cells nearby or far away. These small proteins are created by many kinds of immune system cells and some cells outside of the immune system when there is a threat, and they act like messengers. Interferons are a type of cytokine that warn other cells of an invading virus, for example. This system allows information to be sent quickly and accurately to warn the body about the threat. If tested, cytokines may appear on lab reports as IL-2, IL-4, IL-6, and so on.

Immune dysregulation, which happens in some PIs, is sometimes treated with biologic medications that block cytokines, like tocilizumab (trade name Actemra), to lower the immune system’s overall activation.

There are 30 different proteins that make up the complement system. These proteins work together as part of the innate immune responses against bacteria. Most of them are made in the liver. Some complement proteins coat bacteria to make it easier for neutrophils to eat them. Other parts of the complement system attract neutrophils to the site of an infection. Complement proteins can also join together on the surface of bacteria to break their cell wall and kill them.

How the immune system fights germs

Bacteria

Our bodies are full of bacteria, and bacteria are all around us on most surfaces. Our skin and the inner linings of our body, called mucous membranes, act as physical barriers that keep these bacteria from causing infections in tissues. But if the skin or mucous membranes are damaged by illness or injury, bacteria can get inside the body.

In most cases, bacteria are destroyed through the combined efforts of antibodies, complement proteins, and neutrophils. First, complement proteins and neutrophils act together to find and kill a bacterial cell. Then the B cell with IgM that recognizes that bacteria develops into plasma cells that pump out specific antibodies. The antibodies coat the remaining bacteria and activate complement proteins, which also coat the bacteria. The coating of antibodies and complement proteins helps neutrophils recognize the bacteria as foreign more easily.

The neutrophil starts its attack by attaching to the antibody and complement proteins coating the bacteria. It then stretches out around the germs and swallows them. Once the bacteria are in a pocket inside the neutrophil, special enzymes and toxic reactive oxygen species are released into the pocket, which kills the bacteria.

When antibodies, complement proteins, and neutrophils are working properly, this process usually kills the bacteria effectively. However, sometimes people get bacterial infections repeatedly, and these infections can harm tissues and organs. This can happen if there are too many bacteria or if there are problems with the production of antibodies, complement proteins, or neutrophils.

Fungi (yeast and molds)

Immune system defenses against fungal infections are complex and depend on the type of fungus. Candida albicans is a yeast-like fungus that commonly lives on our skin and mucous membranes without causing harm. A type of helper T cell called Th17 helps the immune system tolerate Candida in these areas while also keeping it from overgrowing and causing infections.

In contrast, molds like Aspergillus spp. are found mostly in the environment—especially in soil and air—and can cause infections when someone inhales their spores. The main defense against molds are neutrophils and macrophages, white blood cells that ingest and destroy fungal cells. However, T cells also contribute to antifungal defense by coordinating the immune response, especially if the infection is serious or invasive.

Viruses

We are often exposed to viruses. Our bodies defend against viruses differently than how they fight bacteria or fungi. Viruses can only live and grow inside our cells, which allows them to hide from parts of our immune system.

When a virus infects a cell, the cell sends out cytokines, especially interferons, to warn other cells about the infection. This warning usually stops other cells from getting infected. However, many viruses can get around this protection and continue to spread the infection.

T cells and NK cells that are moving around in the body are alerted to the viral infection. They travel to the location of the infection and kill the cells that are infected. This method of killing the virus is very destructive because many of our own cells are killed in the process. Even so, it is an effective way to get rid of the virus.

At the same time, T helper cells activate B cells, which begin making antibodies that recognize and block the virus. These antibodies help block infection if we're exposed to the same virus again. The immune system also makes memory T and B cells, which stay in the body and respond quickly if the virus returns—often preventing illness or making future infections milder.

Because neutrophils are not involved in fighting viruses, your white blood cell count usually is not high if you have a viral infection and may actually be low.

One of the biggest improvements in human health over the last 229 years has come from widespread use of vaccines [2]. Because of vaccines, serious viral diseases like polio, smallpox, measles, mumps, and rubella are not common anymore.

  1. Winterbourn CC, Kettle AJ, Hampton MB. Reactive oxygen species and neutrophil function. Annu Rev Biochem. 2016;85: 765–792. DOI: 10.1146/annurev-biochem-060815-014442
  2. A Brief History of Vaccination. In: World Health Organization [Internet]. [cited 1 Oct 2025]. Available: https://www.who.int/news-room/spotlight/history-of-vaccination/a-brief-history-of-vaccination

This page contains general medical and/or legal information that cannot be applied safely to any individual case. Medical and/or legal knowledge and practice can change rapidly. Therefore, this page should not be used as a substitute for professional medical and/or legal advice. Additionally, links to other resources and websites are shared for informational purposes only and should not be considered an endorsement by the Immune Deficiency Foundation.

Adapted from the IDF Patient & Family Handbook for Primary Immunodeficiency Diseases, Sixth Edition 
Copyright ©2019 by Immune Deficiency Foundation, USA