How pneumonia develops in your lungs

Pneumonia happens when germs — usually bacteria or viruses — get into your lungs and cause an infection. Your lungs fill with fluid or pus, which makes it hard for oxygen to reach your bloodstream. This is why pneumonia can make you feel short of breath and exhausted, even when you're resting.

The infection triggers your immune system to fight back, which causes inflammation. That inflammation is what produces the cough, fever, and chest pain you feel. Different types of germs cause different patterns of illness — some pneumonias come on suddenly and hit hard, while others develop slowly over days.

Key Takeaways

  • Bacterial pneumonia is caused by specific bacteria like Streptococcus pneumoniae, which can develop after a cold or flu weakens your lungs' defenses.
  • Viral pneumonia is usually caused by the same viruses that cause colds and flu, and it often improves on its own but can last weeks.
  • Fungal and aspiration pneumonia are less common but happen when fungi are inhaled or when food or liquid accidentally enters the lungs instead of going down the esophagus.
  • Risk factors like age over 65, smoking, chronic lung disease, or a weakened immune system make pneumonia more likely and more severe.
  • The type of germ that causes your pneumonia affects how it's treated and how long recovery takes.

Bacterial pneumonia and why it follows colds

Bacterial pneumonia is caused by bacteria that live in your nose and throat normally but can travel down into your lungs when your defenses are weakened. Streptococcus pneumoniae is the most common cause in adults. Other bacteria include Haemophilus influenzae, Legionella pneumophila (which grows in warm water systems), and Staphylococcus aureus.

Bacterial pneumonia often develops after you've had a viral illness like the flu or a bad cold. The virus damages the lining of your airways, making it easier for bacteria to settle in and multiply. This is why people sometimes feel better for a day or two after the flu, then get suddenly worse — that's often when bacterial pneumonia is starting.

Bacterial pneumonia tends to come on faster than viral pneumonia and usually causes a higher fever. You might cough up mucus that's yellow, green, or rust-colored. Without treatment, bacterial pneumonia can become serious quickly, which is why doctors often prescribe antibiotics when they suspect it.

Viral pneumonia and why it can linger

Viral pneumonia is caused by the same viruses that cause colds and flu — influenza virus, respiratory syncytial virus (RSV), rhinovirus, and others. These viruses infect the cells lining your airways and air sacs, causing inflammation and fluid buildup.

Viral pneumonia usually develops gradually over several days. You might start with a dry cough and gradually develop shortness of breath. The fever is often lower than with bacterial pneumonia, and you may cough up clear or slightly colored mucus rather than thick yellow or green mucus.

Most viral pneumonia improves on its own as your immune system fights off the virus, but recovery can take weeks. During that time you may feel tired and continue to cough even as you feel better. Antibiotics don't work against viruses, so treatment focuses on rest, fluids, and managing your symptoms while your body heals.

Fungal pneumonia and who gets it

Fungal pneumonia is much less common than bacterial or viral pneumonia, but it's important to recognize because it requires different treatment. The most common cause is Histoplasma capsulatum, a fungus found in soil in certain parts of North America, particularly around the Ohio and Mississippi River valleys. Other fungi that cause pneumonia include Coccidioides (found in the southwestern United States) and Cryptococcus.

You get fungal pneumonia by inhaling fungal spores from soil or bird droppings, not from another person. It's not contagious. Fungal pneumonia is most common in people with weakened immune systems — those with HIV, those taking immunosuppressant medications, or those who have had an organ transplant. People with healthy immune systems can get it too, but it's rare.

Fungal pneumonia often develops slowly and can be mistaken for a lingering cold or bronchitis. Diagnosis requires specific testing because the symptoms don't point clearly to fungus, and treatment involves antifungal medications rather than antibiotics.

Aspiration pneumonia and how it happens

Aspiration pneumonia occurs when food, liquid, or stomach contents accidentally enter your lungs instead of going down your esophagus to your stomach. This can happen if you have trouble swallowing, if you're sedated or unconscious, or if you inhale vomit.

When foreign material reaches your lungs, it can cause two problems. First, the material itself can block airways. Second, bacteria that live in your mouth and throat can travel down with it and cause an infection. Aspiration pneumonia is often caused by bacteria that don't usually cause pneumonia in other ways, which is why it requires specific treatment.

People at higher risk include those with swallowing disorders, people who have had a stroke, those with dementia, and people who are sedated during medical procedures. Aspiration pneumonia can develop quickly and needs prompt treatment to prevent serious complications.

Risk factors that make pneumonia more likely

Some people are more likely to develop pneumonia or to have a more severe case. Age is a major factor — people over 65 have weaker immune responses and are at much higher risk. Very young children, especially under age 2, are also vulnerable.

Chronic lung disease like COPD or asthma makes pneumonia more likely because your lungs are already inflamed and less able to clear germs. Smoking damages the cells that sweep bacteria out of your airways, so smokers get pneumonia more often and recover more slowly. A weakened immune system from HIV, cancer treatment, or immunosuppressant medications means your body can't fight off infection as well.

Other risk factors include heart disease, diabetes, liver disease, and recent hospitalization. People who are bedridden or have limited mobility are at higher risk because fluid can pool in their lungs. Recent surgery or a serious illness also temporarily weakens your defenses against pneumonia.

How germs reach your lungs

Germs reach your lungs through your airways — usually by breathing them in. When someone with pneumonia coughs or sneezes, they release droplets containing bacteria or viruses into the air. If you breathe those droplets in, the germs can settle in your lungs and start an infection.

Your lungs have defenses against this. Cells lining your airways produce mucus that traps germs, and tiny hair-like structures called cilia sweep that mucus upward so you cough it out. But if those defenses are weakened — by a recent viral illness, smoking, or a chronic lung condition — germs can get past them and reach the air sacs deep in your lungs where they multiply.

Germs can also reach your lungs through your bloodstream if you have a bacterial infection elsewhere in your body, though this is less common. And as mentioned, aspiration pneumonia happens when germs travel down your esophagus with food or liquid instead of being inhaled.

Frequently Asked Questions

Can you catch pneumonia from someone else?

Bacterial and viral pneumonia can spread from person to person through coughing and sneezing, though not everyone exposed will develop pneumonia. Fungal pneumonia is not contagious — you get it from the environment, not from another person. Aspiration pneumonia cannot spread because it's caused by your own stomach contents or food, not by germs from another person.

Why do some people get pneumonia after the flu and others don't?

The flu damages your lungs' defenses, but whether bacterial pneumonia develops depends on several factors: which bacteria you're exposed to, how weakened your immune system is, whether you smoke, and your age and overall health. Some people's immune systems recover quickly enough to prevent bacteria from taking hold, while others' defenses stay compromised long enough for an infection to start.

Is pneumonia always caused by an infection?

Most pneumonia is caused by infection, but chemical pneumonia can develop if you inhale toxic fumes or aspirate certain liquids. Aspiration of stomach acid, for example, can damage lung tissue without necessarily causing a bacterial infection. These non-infectious types are less common and are treated differently than infectious pneumonia.

Can you get pneumonia from cold air or wet weather?

Cold air and wet weather don't directly cause pneumonia — only germs do. However, cold weather keeps people indoors in close contact, which spreads respiratory viruses more easily. And people with chronic lung conditions may have more symptoms in cold air, which can make them more vulnerable to infection if they're also exposed to germs.