Pneumonia starts when germs get into your lungs and your body cannot clear them out

Pneumonia happens when bacteria, viruses, or fungi enter the air sacs in your lungs (called alveoli) and multiply. Your immune system tries to fight the infection, which causes inflammation and fluid buildup. That fluid keeps oxygen from moving into your bloodstream, which is why pneumonia makes breathing harder and can make you feel very sick.

The germs that cause pneumonia are usually already around you — in the air, on surfaces, or in your own mouth. Most of the time your body's defenses stop them before they reach your lungs. But if your immune system is weakened, or if you breathe in a large amount of germs, or if the germs are particularly aggressive, an infection can take hold.

Key Takeaways

  • Bacteria, viruses, and fungi are the three main causes of pneumonia, and each type spreads and responds to treatment differently.
  • Your risk of getting pneumonia is higher if you smoke, have a chronic lung disease, are over 65, or have a weakened immune system.
  • Pneumonia can develop after a cold or flu because those viruses damage your airways and make it easier for bacteria to move in.
  • Aspiration pneumonia happens when food, liquid, or stomach contents accidentally enter your lungs instead of going down your esophagus.
  • The germs that cause pneumonia spread through respiratory droplets when an infected person coughs or sneezes, or sometimes through contaminated surfaces.

Bacterial pneumonia and how it spreads

Streptococcus pneumoniae is the most common bacterial cause of pneumonia in adults. Other bacteria that cause pneumonia include Haemophilus influenzae, Legionella, and Mycoplasma. Bacterial pneumonia usually develops suddenly and causes high fever, cough with colored sputum (mucus), and chest pain.

Bacterial pneumonia spreads when an infected person coughs or sneezes and releases droplets into the air. You can catch it by breathing in those droplets, or by touching a surface where the droplets landed and then touching your face. People who live or work in close quarters — like nursing homes, military barracks, or crowded shelters — have higher risk of catching bacterial pneumonia.

Bacterial pneumonia is the type most likely to cause severe illness and is the kind doctors typically treat with antibiotics. If left untreated, it can spread to the bloodstream and become life-threatening.

Viral pneumonia and why it is harder to treat

Viruses that cause pneumonia include influenza (flu), respiratory syncytial virus (RSV), rhinovirus, and coronavirus. Viral pneumonia usually develops more slowly than bacterial pneumonia and causes a dry cough, fatigue, and shortness of breath. You may have a low fever or no fever at all.

Viral pneumonia spreads the same way as bacterial pneumonia — through respiratory droplets from coughing and sneezing. Because antibiotics do not work against viruses, treatment focuses on rest, fluids, and letting your immune system fight the infection. Some antiviral medications exist for specific viruses like influenza, but they work best if started early.

Viral pneumonia is often less severe than bacterial pneumonia, but it can weaken your lungs and make them vulnerable to a secondary bacterial infection. This is why people sometimes develop bacterial pneumonia on top of viral pneumonia.

Fungal pneumonia and who is most at risk

Fungal pneumonia is less common than bacterial or viral pneumonia and usually only develops in people with weakened immune systems. People with HIV/AIDS, those taking immunosuppressant medications after an organ transplant, or those undergoing chemotherapy are at highest risk. Common fungal causes include Pneumocystis jirovecii, Histoplasma, and Coccidioides.

Some fungal pneumonias come from breathing in fungal spores from the environment — soil, bird droppings, or contaminated water. Others develop when fungi already present in your body (often in your mouth or digestive tract) spread to your lungs because your immune system cannot control them.

Fungal pneumonia can be slow to develop and hard to diagnose because symptoms are vague. Treatment requires antifungal medications and may take weeks or months.

Aspiration pneumonia happens when food or liquid enters your lungs

Aspiration pneumonia develops when you accidentally inhale food, liquid, stomach contents, or saliva into your lungs instead of swallowing them down your esophagus. This can happen if you have trouble swallowing, are sedated or unconscious, or have a condition that weakens your swallowing reflex.

People at higher risk of aspiration pneumonia include those with stroke, Parkinson's disease, dementia, or severe gastroesophageal reflux disease (GERD). It also happens more often in people who are sedated during surgery or in those with feeding tubes. Aspiration pneumonia is usually caused by bacteria that live in your mouth and throat, so it is often treated with antibiotics that cover multiple types of bacteria.

Risk factors that make pneumonia more likely

Your age, health history, and habits all affect your risk. Adults over 65 have higher risk, as do infants under 2 years old. Smoking damages the lining of your airways and weakens your immune response, making pneumonia more likely. Chronic lung diseases like COPD or asthma, heart disease, and diabetes all increase risk.

A weakened immune system — from HIV, cancer treatment, or medications that suppress immunity — makes pneumonia more likely and more severe. Recent surgery, prolonged bed rest, or being on a ventilator in a hospital also raise risk. Alcohol use disorder damages your immune system and your ability to clear germs from your lungs.

If you have had pneumonia before, your risk of getting it again is higher. Recent viral infections like cold or flu also set the stage for pneumonia because they damage your airways.

How a cold or flu can lead to pneumonia

When you have a cold or flu, the virus damages the cells lining your airways. This damage makes it harder for your lungs to clear mucus and bacteria. Bacteria that normally live harmlessly in your throat can then move down into your lungs and cause a secondary bacterial infection — pneumonia on top of the viral illness.

This is why pneumonia sometimes develops a few days after you start feeling better from a cold or flu. You may think you are recovering, but then your cough gets worse, your fever returns or stays high, and you feel more short of breath. This pattern — improvement followed by worsening — is a sign that bacterial pneumonia may have developed.

People over 65, those with chronic lung disease, and those with weakened immune systems are at highest risk of developing pneumonia after a viral infection.

Frequently Asked Questions

Can you catch pneumonia from someone who has it?

Yes, if the pneumonia is caused by bacteria or viruses. Respiratory droplets from coughing and sneezing spread the germs. Fungal pneumonia is not spread from person to person. If someone in your home has pneumonia, wash your hands often and avoid sharing eating utensils or drinking glasses.

Does pneumonia always start with a cold or flu?

No. Pneumonia can develop on its own without a preceding viral illness. You can catch pneumonia directly from breathing in bacteria or viruses, or from aspiration. However, having a recent cold or flu does increase your risk because it damages your airways.

Why do some people get pneumonia and others don't when exposed to the same germs?

Your immune system strength, age, overall health, and whether you smoke all matter. People with weakened immunity, chronic diseases, or who smoke are more likely to develop pneumonia after exposure. Vaccination against pneumococcal bacteria and influenza also reduces risk in many people.

Is pneumonia contagious before symptoms start?

Yes. People can spread respiratory viruses and bacteria for a day or two before symptoms appear. This is why pneumonia spreads easily in workplaces and schools — people are contagious before they know they are sick.

Can you get pneumonia from air conditioning or dirty air?

Legionella bacteria, which causes a type of pneumonia called Legionnaires' disease, can grow in air conditioning systems and hot water tanks. Most pneumonia comes from person-to-person spread or from germs already in your body, not from air quality alone.