Pneumonia starts when germs reach your lungs and your immune system cannot clear them fast enough

Pneumonia develops when bacteria, viruses, or fungi enter your lungs and multiply faster than your body can fight them off. The infection causes your air sacs (called alveoli) to fill with fluid or pus, which makes it harder for oxygen to reach your bloodstream. You do not catch pneumonia the same way every time — the path depends on what germ causes it, your age, your overall health, and whether your immune system is already weakened.

Most people get pneumonia through breathing in germs that are already in the air around them or in their own mouth and throat. Some get it after a cold or flu virus has already damaged their lungs. Others develop it because they cannot cough properly, or because they breathe in food or liquid by accident. Understanding how you might get pneumonia helps you recognize when to seek care and what steps reduce your risk.

Key Takeaways

  • Pneumonia develops when germs multiply in your lungs faster than your immune system can fight them, usually after breathing them in or after another respiratory illness weakens your defenses.
  • Bacterial pneumonia often follows a cold or flu, while viral pneumonia can develop on its own or as part of a respiratory infection.
  • People with weakened immune systems, chronic lung disease, heart disease, or those over 65 have a much higher risk of developing pneumonia.
  • Aspiration pneumonia occurs when food, liquid, or stomach contents accidentally enter your lungs instead of going down your esophagus, which happens more often after stroke, during sedation, or with swallowing problems.

Breathing in germs from the air or from another person

The most common way pneumonia starts is through breathing. 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 travel down your windpipe and into your lungs. You can also pick up pneumonia germs from surfaces — touching a contaminated doorknob or handrail and then touching your face can transfer the germ to your mouth or nose, where it can be inhaled.

Not everyone who breathes in pneumonia germs gets sick. Your lungs have a cleaning system: tiny hairs called cilia sweep mucus and germs upward and out. Your immune system also produces antibodies and white blood cells that attack invaders. Pneumonia develops when the germ is strong enough or present in large enough numbers to overwhelm this defense, or when your immune system is already busy fighting something else.

Bacterial pneumonia that follows a cold or flu

A cold or flu virus damages the lining of your airways and lungs, leaving them inflamed and raw. This damage makes it easier for bacteria to take hold. Streptococcus pneumoniae is the most common bacterial pneumonia that develops this way, but Haemophilus influenzae and Staphylococcus aureus also follow viral infections. You may feel better from the cold for a few days, then suddenly feel worse — higher fever, worse cough, chest pain, or shortness of breath — which signals that bacteria have moved in.

This pattern is why people recovering from flu are at particular risk. The flu virus itself can cause viral pneumonia, but it also opens the door for secondary bacterial infection. This is one reason flu vaccination and early treatment with antiviral medications matter: they reduce the chance that a viral infection will progress to bacterial pneumonia.

Viral pneumonia that develops during or after respiratory illness

Some viruses cause pneumonia directly without needing bacteria to follow. Respiratory syncytial virus (RSV), influenza, parainfluenza, and rhinovirus can all infect the lungs themselves and cause inflammation and fluid buildup. COVID-19 can also cause viral pneumonia, sometimes severe enough to require hospitalization. Viral pneumonia often develops gradually — your cough worsens, you feel more fatigued, and breathing becomes harder over several days.

Viral pneumonia is usually milder than bacterial pneumonia, but not always. Some people, especially older adults and those with chronic illness, develop severe viral pneumonia that damages lung tissue. Antibiotics do not work against viruses, so treatment focuses on supporting your body while it fights the infection — rest, fluids, oxygen if needed, and sometimes antiviral medications if caught early.

Aspiration pneumonia from food or liquid entering the lungs

Aspiration pneumonia develops when food, liquid, stomach contents, or saliva accidentally enter your lungs instead of going down your esophagus to your stomach. This can happen if you have trouble swallowing, if you are sedated during a medical procedure, if you have a stroke that affects swallowing, or if you inhale vomit. The material itself can block airways, but more often bacteria from your mouth or stomach colonize the lungs and cause infection.

People at higher risk for aspiration include those with neurological conditions like Parkinson's disease or ALS, those who have had a stroke, people with dementia, those with severe reflux disease, and anyone who has difficulty swallowing. Aspiration pneumonia can develop quickly or slowly depending on what was aspirated and how much. If you notice coughing during or right after swallowing, or if you develop pneumonia symptoms after a procedure or illness that affected swallowing, tell your doctor about the possibility of aspiration.

Weakened immune system as a major risk factor

Your immune system is your primary defense against pneumonia germs. When it is weakened, germs that would normally be cleared away instead take hold and multiply. HIV/AIDS, chemotherapy, long-term corticosteroid use, and medications that suppress the immune system all increase pneumonia risk. People with diabetes, chronic kidney disease, or liver disease also have weaker immune responses. Older adults naturally have less effective immune systems, which is why pneumonia is more serious in people over 65.

If your immune system is compromised, you may develop pneumonia from germs that would not normally cause it in healthy people — fungi like Pneumocystis jirovecii or bacteria like Mycobacterium avium. You may also develop pneumonia more easily, get sicker faster, and take longer to recover. This is why people with weakened immunity are often advised to get pneumonia vaccines and to seek medical care quickly if respiratory symptoms develop.

Chronic lung disease and heart disease as underlying conditions

If you have chronic obstructive pulmonary disease (COPD), asthma, cystic fibrosis, or pulmonary fibrosis, your lungs are already damaged or inflamed. This makes it harder for your cleaning system to work and easier for pneumonia germs to establish infection. Similarly, heart disease — especially heart failure — can cause fluid to back up into your lungs, creating an environment where bacteria thrive. People with these conditions get pneumonia more often and tend to have more severe cases.

Smoking also damages the cilia that sweep germs out of your lungs and weakens immune cells in your airways. Smokers and former smokers have higher pneumonia risk than people who have never smoked. If you have any chronic lung or heart condition, your doctor may recommend pneumonia vaccination and may advise you to get a flu shot each year to prevent the respiratory infections that often lead to pneumonia.

How your body's defenses fail to stop the infection

Pneumonia does not develop because a germ is present — it develops because the germ multiplies faster than your body can eliminate it. Several things can tip this balance. If you are already fighting off another infection, your immune system is stretched thin. If you are very tired, stressed, or malnourished, your white blood cells do not work as well. If you have just had surgery or a serious illness, your body is in recovery mode and less able to mount a strong defense.

Cold air, air pollution, and secondhand smoke can also slow your cilia and irritate your airways, making infection more likely. Alcohol use impairs immune function and weakens your cough reflex, so people who drink heavily are at higher risk. The more of these factors present at once, the more likely pneumonia will develop if you are exposed to a pneumonia germ.

Frequently Asked Questions

Can you get pneumonia from being cold or wet?

Cold air and wet conditions do not directly cause pneumonia, but they can make you more vulnerable. Cold temperatures slow the cilia in your airways, and being wet and chilled can stress your immune system. If you are already exposed to pneumonia germs, these conditions make infection more likely. The real risk is exposure to the germ itself, not the weather.

Is pneumonia contagious?

Bacterial and viral pneumonia can spread from person to person through coughing and sneezing, though not everyone exposed will get sick. Your risk depends on how close you are, how long you are near the person, and how strong your immune system is. Aspiration pneumonia is not contagious because it comes from your own mouth and stomach contents, not from a germ someone else has.

Can you get pneumonia from your own bacteria?

Yes. Your mouth and throat normally contain bacteria that do not cause problems. If these bacteria are inhaled into your lungs — through aspiration or because your immune system is very weak — they can cause pneumonia. This is why aspiration pneumonia develops from your own oral bacteria, not from catching something from someone else.

What is the difference between walking pneumonia and regular pneumonia?

Walking pneumonia is usually caused by Mycoplasma pneumoniae and tends to be milder — you may have a cough and fatigue but feel well enough to go about your day. Regular pneumonia causes more severe symptoms like high fever, chest pain, and shortness of breath that usually keep you home or in the hospital. Both develop the same way (breathing in germs), but the germ and your immune response determine how sick you become.

Can pneumonia develop without being around someone who is sick?

Yes. You can develop pneumonia from germs already in your environment or in your own mouth and throat. Aspiration pneumonia develops from your own bacteria. Viral pneumonia can develop after a cold or flu you caught weeks earlier. You do not need to be around someone actively sick with pneumonia to develop it yourself.