The main causes of pneumonia

Pneumonia happens when germs — usually bacteria, viruses, or fungi — get into your lungs and cause an infection. The infection makes the air sacs in your lungs fill with fluid or pus, which stops oxygen from reaching your bloodstream. Different types of germs cause different kinds of pneumonia, and knowing which type you have matters because the treatment changes depending on the cause.

The three most common causes are bacterial pneumonia, viral pneumonia, and fungal pneumonia. Bacterial pneumonia is usually the most serious and the most treatable with antibiotics. Viral pneumonia often comes on after a cold or flu and usually gets better on its own, though it can be severe in older adults or people with weak immune systems. Fungal pneumonia is rare in healthy people but can develop in those with certain health conditions or weakened immunity.

Key Takeaways

  • Bacterial pneumonia is caused by specific bacteria like Streptococcus pneumoniae and is treated with antibiotics.
  • Viral pneumonia often follows a cold or flu and usually improves without antibiotics, though it can be serious in vulnerable people.
  • Fungal pneumonia is uncommon in healthy people but can occur in those with weakened immune systems or certain lung conditions.
  • Your doctor identifies the cause through chest X-rays, blood tests, and sometimes sputum cultures before deciding on treatment.
  • Some people get pneumonia from aspiration — when food or stomach contents accidentally enter the lungs instead of going down the esophagus.

Bacterial pneumonia and how it spreads

Bacterial pneumonia is caused by bacteria that live in the nose, throat, or mouth and can travel into the lungs when you breathe. The most common culprit is Streptococcus pneumoniae, a bacterium that many people carry without getting sick. It causes problems when it reaches the lungs, especially if your immune system is weakened by age, another illness, or smoking.

Other bacteria that cause pneumonia include Haemophilus influenzae, Legionella pneumophila (which spreads through water systems), and Mycoplasma pneumoniae (which causes a milder form sometimes called "walking pneumonia"). Bacterial pneumonia spreads person-to-person through coughing and sneezing, similar to how a cold spreads. It typically comes on suddenly with high fever, cough, and chest pain, and it responds to antibiotics.

Viral pneumonia and respiratory infections

Viral pneumonia usually develops after you have had a cold or the flu. The viruses that cause these common illnesses — like influenza, rhinovirus, and respiratory syncytial virus (RSV) — can move from your upper airways into your lungs. Once there, they damage the lining of the air sacs and cause inflammation, which fills those spaces with fluid.

Viral pneumonia often starts with the typical cold or flu symptoms: cough, sore throat, runny nose, and body aches. The cough may linger for weeks even after you start feeling better. Most people recover without antibiotics because antibiotics do not work against viruses. However, viral pneumonia can become serious in older adults, pregnant people, and those with chronic heart or lung disease, so medical attention is still important.

Fungal pneumonia and who gets it

Fungal pneumonia is caused by breathing in fungal spores from the environment — usually from soil, bird droppings, or decaying plant material. Healthy people rarely develop fungal pneumonia because their immune systems fight off the spores. The people at highest risk are those with weakened immunity, including those with HIV/AIDS, those taking medications that suppress the immune system, or those with conditions like diabetes or chronic lung disease.

Common fungi that cause pneumonia include Histoplasma, Coccidioides, and Cryptococcus. Fungal pneumonia develops slowly over weeks or months, unlike bacterial pneumonia which comes on suddenly. Symptoms include a persistent cough, fever, and fatigue. Treatment requires antifungal medications, which work differently than antibiotics and may need to be taken for a long time.

Aspiration pneumonia and how it happens

Aspiration pneumonia occurs when food, saliva, or stomach contents accidentally go into your lungs instead of down your esophagus to your stomach. This can happen if you have trouble swallowing, if you are unconscious, or if you inhale vomit. Once these materials reach the lungs, they can cause infection because they carry bacteria from your mouth and stomach.

People at higher risk for aspiration include those with swallowing disorders, older adults, people with neurological conditions like stroke or Parkinson's disease, and those who are sedated or unconscious. Aspiration pneumonia can be caused by bacteria that normally live in your mouth, making it different from pneumonia caught from someone else. Treatment usually involves antibiotics that target mouth bacteria, along with addressing the underlying swallowing problem.

How doctors figure out what is causing your pneumonia

Your doctor starts by listening to your lungs with a stethoscope and asking about your symptoms and how quickly they started. A chest X-ray shows whether you have pneumonia and sometimes hints at the cause — bacterial pneumonia often looks different on the image than viral pneumonia. Blood tests can show signs of bacterial infection, and a sputum culture (a sample of mucus you cough up) can identify the specific bacterium or fungus.

In some cases, your doctor may order a CT scan or bronchoscopy (a procedure where a thin tube with a camera looks inside your airways) if the diagnosis is unclear or if you are not improving with treatment. Knowing the cause matters because it determines treatment: bacterial pneumonia needs antibiotics, viral pneumonia usually just needs rest and supportive care, and fungal pneumonia requires antifungal drugs. Your doctor may start antibiotics before the test results come back if bacterial pneumonia seems likely, then adjust the medication once they know for certain.

Risk factors that make pneumonia more likely

Certain conditions and habits make you more vulnerable to pneumonia from any cause. Smoking damages the lining of your airways and weakens your immune response, making infection more likely. Age matters too — pneumonia is more serious in children under 5 and adults over 65. Chronic diseases like asthma, COPD, heart disease, and diabetes all increase your risk.

A weakened immune system from HIV, cancer treatment, or immunosuppressant medications makes you vulnerable to all types of pneumonia, including rare fungal forms. Recent hospitalization, especially if you were on a ventilator, raises the risk of hospital-acquired pneumonia caused by bacteria that live in medical settings. Recent viral infections like flu also set the stage for bacterial pneumonia to develop afterward.

Frequently Asked Questions

Can you get pneumonia from someone else?

Yes, if it is bacterial or viral pneumonia. These spread through coughing and sneezing, similar to how colds spread. Fungal pneumonia does not spread person-to-person — you get it by breathing in spores from the environment. Aspiration pneumonia is not contagious because it comes from your own mouth and stomach bacteria.

Is pneumonia always caused by an infection?

Most pneumonia is caused by infection, but not all. Chemical pneumonia can happen if you breathe in toxic fumes or aspirate certain liquids. Aspiration of non-infectious material can also cause inflammation. However, the most common causes are bacterial, viral, and fungal infections.

Why does the cause of pneumonia matter for treatment?

Because different causes need different treatments. Antibiotics kill bacteria but do not work against viruses or fungi. Antifungal medications are needed for fungal pneumonia. Knowing the cause helps your doctor choose the right medication and predict how long recovery will take.

Can you have pneumonia from more than one cause at once?

Yes. You can have viral pneumonia and then develop bacterial pneumonia on top of it — this is called secondary bacterial pneumonia. Some people with weakened immune systems can have multiple infections at the same time. Your doctor will test for this if you are not improving as expected.

Does the season affect what type of pneumonia you get?

Viral pneumonia is more common in winter when cold and flu viruses spread more easily. Fungal pneumonia depends on where you live and exposure to specific fungi in the environment. Bacterial pneumonia can happen any time of year, though it is also more common in winter months.