provider image
Welcome! You’re in GoodRx for healthcare professionals. Now, you’ll enjoy a streamlined experience created specifically for healthcare professionals.
Skip to main content
HomeHealth ConditionsPneumonia

How Do People Get Pneumonia? What to Know About Causes and Risk Factors

Amy Walsh, MD, MDPMandy Armitage, MD
Written by Amy Walsh, MD, MDP | Reviewed by Mandy Armitage, MD
Published on December 5, 2024

Key takeaways:

  • Bacteria is the most common cause of pneumonia. Viruses and fungi can also cause it. 

  • Young children, older adults, and people with chronic medical conditions are at highest risk of getting pneumonia.

  • See a healthcare professional right away if you have trouble breathing, high fever, chest pain, or bluish skin.

Healthcare professional with a stethoscope examining an older woman.
FG Trade/E+ via Getty Images

Pneumonia is an infection in the lungs. Bacteria, viruses, and fungi can cause pneumonia, leading the lungs to fill with fluid or pus. It’s not always severe. But sometimes breathing difficulties from pneumonia need hospital treatment. Some people are at higher risk of developing pneumonia and getting sicker with it. 

The good news is that there are things you can do to reduce your risk of developing pneumonia. Understanding how people get it — and who’s at risk — can help prevent severe illness. 

How do you get pneumonia?

You can get pneumonia after exposure to microorganisms that cause infection. This happens when people who are infected cough, sneeze, or talk. This sends droplets into the air, which other people can breathe in. 

You can also get pneumonia from germs on surfaces or objects if you touch that surface and then touch your nose or mouth. But this is less common.

If you have a weakened immune system or certain medical conditions (see below), it’s easier to get pneumonia. This is especially true for fungal pneumonia, which can happen after exposure to fungus in the environment. 

What are the common causes of pneumonia?

Bacteria, viruses, and fungi can cause pneumonia. Bacterial pneumonia is the most common and requires treatment with antibiotics. It tends to make people sicker than viral pneumonias. Fungal pneumonias tend to most often affect people with weaker immune systems. 

GoodRx icon
  • What does pneumonia feel like? Someone who’s been hospitalized several times with pneumonia shares his firsthand experience.

  • COVID-19 is still with us. So, it’s helpful to understand the signs and symptoms of COVID pneumonia — and to know when to get help. 

  • What exactly is walking pneumonia? The name of this respiratory illness might be confusing. But the symptoms are pretty straightforward.

Bacteria

Bacteria can cause infection directly and fill your lungs with fluid or pus. Common causes of bacterial pneumonia include: 


There are other types of bacteria that cause atypical pneumonia (also known as “walking” pneumonia). Common causes of atypical pneumonia include: 

  • Mycoplasma pneumoniae

  • Chlamydia pneumoniae

  • Legionella pneumophila, which can cause a severe illness called Legionnaires’ disease 

People who have trouble swallowing or coughing (after a stroke, for example) are at risk for aspiration pneumonia. If they accidentally inhale liquid or stomach contents, it can lead to bacterial infection in the lungs. 

Viruses

Many viruses can cause pneumonia. Viral pneumonias don’t respond to antibiotic medicines. 

Common viral causes of pneumonia include: 

Fungi

Fungi live in the soil in many areas of the U.S. They can often be found in bird droppings, as well. 

Some causes of fungal pneumonia include: 

  • Coccidioides, a fungus that causes valley fever

  • Histoplasma, a fungus found in soil, as well as bat and bird droppings

  • Blastomyces, a yeast fungus

Fungal pneumonias are rare. They tend to affect people who have weakened immune systems due to:

  • HIV 

  • Chemotherapy

  • Older age

  • Medications for organ transplants or autoimmune illnesses

Can you catch pneumonia from somebody with it?

Whether you can catch pneumonia from someone with pneumonia depends on the cause of their illness. The bacteria and viruses that cause pneumonia are contagious. But not everyone who’s exposed to those bacteria and viruses will develop pneumonia. 

For example, if you’re exposed to a person with a milder illness, like a cold, that could turn into pneumonia if you have a weakened immune system and you’re unable to fight it off. 

If you have bacterial pneumonia, you remain contagious until you’ve been on antibiotics for 48 hours. If you have pneumonia caused by a virus, you could spread that virus until your symptoms start to go away. 

Fungal pneumonia isn’t contagious.

Who is more likely to develop pneumonia?

It’s important to know that anyone can get pneumonia. But there are some things that make it more likely for some people. 

These risk factors include: 

  • Extremes of age (being under age 2 or over age 65) 

  • Tobacco and alcohol use

  • Lung disease, such as asthma or chronic obstructive pulmonary disease (COPD)

  • Other medical conditions, like diabetes, heart failure, and liver disease

  • Sickle-cell disease

  • Weakened immune system

  • Recent illness or hospitalization 

When should you seek medical care for pneumonia?

If you’re concerned that you may have pneumonia, you should call or see a healthcare professional. 

Common symptoms of pneumonia include: 

  • Cough, especially with mucus 

  • Fever and chills

  • Shortness of breath 

  • Fast breathing

  • Chest pain with coughing or deep breaths

  • Decreased appetite and energy

  • Nausea and vomiting, especially in younger children

  • Confusion, especially in older adults


See a healthcare professional right away if you have: 

  • Trouble breathing

  • Blue lips or fingers

  • Chest pain

  • Fever over 103°F, especially if it doesn’t decrease with acetaminophen or ibuprofen 

If you’re at higher risk, you shouldn’t wait to seek medical attention if you develop symptoms of pneumonia. Symptoms can worsen quickly and even become life-threatening. 

How can you prevent pneumonia?

There are steps you can take to decrease your chances of developing pneumonia and the severity of pneumonia if you do get it.

Vaccines are an important way to prevent pneumonia. There are four pneumonia vaccines available in the U.S. While they don’t prevent every kind of pneumonia, they do prevent several strains of Streptococcus pneumoniae. This is the most common cause of bacterial pneumonia. 

Other important vaccines that can reduce the risk of pneumonia include:

  • Pneumococcal vaccine

  • COVID vaccine

  • RSV vaccine

  • Flu vaccine

Some people who’ve received a vaccine may still get sick with this type of pneumonia. But, if they do, they tend to have milder infections and fewer complications. If you get pneumonia after receiving a vaccine it doesn’t mean the vaccine was ineffective.

There are other ways you can prevent pneumonia, too. You can: 

  • Wash your hands or use hand sanitizer frequently to kill germs.

  • Quit smoking, since smoking makes it difficult for your lungs to protect against infection.

  • Exercise, get plenty of sleep, and eat nutritious food to help keep your immune system strong.

  • If you have a weakened immune system, you may need to take antibiotics to prevent infection, even if you don’t have an infection. 

  • If you have problems swallowing, you may need to take steps to prevent aspiration. These include eating smaller meals, thickening liquids, and elevating your head while sleeping. 

The bottom line

Pneumonia is a lung infection commonly caused by bacteria and viruses. People do spread these bacteria and viruses, though they don’t always cause pneumonia. Older adults, babies, and people with chronic medical conditions are at higher risk. Getting vaccinations, quitting smoking, and eating a healthy diet reduce your risk of pneumonia. See a healthcare professional right away if you develop difficulty breathing, chest pain, high fever, or blue skin.

why trust our exports reliability shield

Why trust our experts?

Amy Walsh, MD, MDP
I have worked as an emergency physician for 15 years, including care at both rural hospitals and trauma centers. I am the former Global Emergency Medicine fellowship director at Health Partners.
Patricia Pinto-Garcia, MD, MPH
Patricia Pinto-Garcia, MD, MPH, is a medical editor at GoodRx. She is a licensed, board-certified pediatrician with more than a decade of experience in academic medicine.
Mandy Armitage, MD
Reviewed by:
Mandy Armitage, MD
Mandy Armitage, MD, has combined her interests in clinical medicine with her passion for education and content development for many years. She served as medical director for the health technology companies HealthLoop (now Get Well) and Doximity.

References

American Lung Association. (2024). What causes pneumonia?

Centers for Disease Control and Prevention. (2024). Fungal community-acquired pneumonias.

View All References (5)

MedlinePlus. (2023). Pneumonia.

National Cancer Institute. (n.d.). Immunocompromised.

National Heart, Lung, and Blood Institute. (2022). Pneumonia: Causes and factors.

National Heart, Lung, and Blood Institute. (2022). Pneumonia: Prevention.

Nemours KidsHealth. (2024). Your child's vaccines: Hib vaccine.

GoodRx Health has strict sourcing policies and relies on primary sources such as medical organizations, governmental agencies, academic institutions, and peer-reviewed scientific journals. Learn more about how we ensure our content is accurate, thorough, and unbiased by reading our editorial guidelines.

Was this page helpful?

Get the facts on Pneumonia.

Sign up for our newsletter to get expert tips on condition management and prescription savings.

By signing up, I agree to GoodRx's Terms and Privacy Policy, and to receive marketing messages from GoodRx.

Related Articles