Doctors Note Logo

Published on: 9/23/2026

How do you get pneumonia, and is it contagious?

Pneumonia happens when bacteria, viruses, or fungi reach the air sacs of the lungs and trigger inflammation, often after a cold or flu, through inhaled droplets, or when saliva, food, or vomit is breathed in. Many of the germs that cause it, including flu, COVID-19, RSV, and pneumococcus, do spread person to person, so pneumonia can be contagious depending on its cause, while types like aspiration and fungal pneumonia are not. Risk rises with age over 65, infancy, smoking, chronic lung or heart disease, and a weakened immune system, and the details below explain how long you may be contagious and which cases need urgent care. Because cough, fever, and breathlessness overlap with bronchitis, asthma, and other conditions, a free, instant, online symptom check can help you sort out what your symptoms most likely point to in just a few minutes. It is private, requires no appointment, and gives you a clear sense of whether to monitor at home, book a visit, or seek emergency care right away.

Last reviewed for medical accuracy: 09/23/2026

answer background

Explanation

How Do You Get Pneumonia, and Is It Contagious?

Pneumonia is an infection of the lungs that causes the air sacs (alveoli) to fill with fluid or pus. It can make breathing difficult and may lead to serious complications, especially in young children, older adults, and people with weakened immune systems. Understanding how you get pneumonia and whether it’s contagious can help you take steps to protect yourself and your loved ones.

What Causes Pneumonia?

Pneumonia can be caused by various germs, including bacteria, viruses, and fungi. The most common culprits are:

  • Bacteria

    • Streptococcus pneumoniae (pneumococcus)
    • Haemophilus influenzae
    • Mycoplasma pneumoniae (often called “walking pneumonia”)
  • Viruses

    • Influenza (flu) viruses
    • Respiratory syncytial virus (RSV)
    • Coronaviruses (e.g., SARS-CoV-2)
  • Fungi (less common, often affects those with weakened immunity)

    • Pneumocystis jirovecii
    • Histoplasma capsulatum
    • Cryptococcus neoformans

How Do You Get Pneumonia?

You “get” pneumonia when one of these pathogens reaches your lungs and overcomes your natural defense systems. Key routes of infection include:

  1. Inhaling Infectious Droplets

    • When someone with a respiratory infection coughs or sneezes, tiny droplets containing bacteria or viruses can become airborne.
    • You breathe in these droplets and the germs settle in your lungs.
  2. Aspiration (Breathing in Food, Drink, or Vomit)

    • If you have trouble swallowing—due to intoxication, sedation or a neurological condition—you may accidentally inhale liquids or particles into your lungs.
    • This can carry mouth bacteria deep into the lung tissue, leading to aspiration pneumonia.
  3. Spread from Nearby Infections

    • Sometimes bacteria from a sinus or middle ear infection can travel down your respiratory tract into the lungs.
  4. Bloodstream Infection

    • In rare cases, germs from another part of your body (e.g., a urinary tract infection) can enter the bloodstream and seed the lungs.
  5. Hospital-Acquired (Nosocomial) Pneumonia

    • People on ventilators or with weakened immune systems in healthcare settings can develop pneumonia from bacteria present in that environment.

Is Pneumonia Contagious?

Whether pneumonia is contagious depends on its cause:

  • Contagious Types

    • Bacterial pneumonia (e.g., pneumococcus, Mycoplasma) can spread through respiratory droplets.
    • Viral pneumonia (e.g., influenza, RSV, COVID-19) is also transmitted by droplets or direct contact.
  • Non-Contagious Types

    • Aspiration pneumonia is caused by inhaling material that isn’t infectious.
    • Fungal pneumonia generally isn’t spread person-to-person; it’s acquired from environmental spores.

Key points on contagiousness:

  • You’re most likely to spread bacterial or viral pneumonia before your symptoms start or during your first few days of illness.
  • Good respiratory etiquette—covering coughs, wearing masks, frequent handwashing—lowers the risk of spreading germs.
  • Close contacts (family, caregivers) are at higher risk, especially if they have weakened defenses or chronic lung conditions.

Who’s at Higher Risk?

Certain factors make it easier for pneumonia-causing germs to take hold:

  • Age under 2 or over 65
  • Chronic lung diseases (COPD, asthma)
  • Heart disease, diabetes, or kidney problems
  • Weakened immune systems (HIV, cancer treatments, steroids)
  • Recent viral infection (like the flu or COVID-19)
  • Hospitalization, especially if on a ventilator
  • Smoking or exposure to secondhand smoke

Recognizing Early Signs

Knowing early symptoms can help you seek timely care. Common signs include:

  • Persistent cough (may produce green, yellow or bloody mucus)
  • Fever, chills and sweating
  • Rapid, shallow breathing or shortness of breath
  • Chest pain that worsens when you breathe or cough
  • Fatigue, muscle aches, loss of appetite
  • In older adults: confusion, low body temperature, weakness

If you’re unsure whether it’s a mild cold, the flu or pneumonia, you might consider a free, online symptom check, using the doctor approved Ubie Symptom Checker.

Preventing Pneumonia

While you can’t eliminate all risk, these steps help protect you and others:

  • Vaccination

    • Pneumococcal vaccines for adults and children (consult your doctor)
    • Annual flu shot
    • COVID-19 vaccine and boosters as recommended
  • Good Hygiene

    • Wash hands with soap and water (20 seconds minimum)
    • Use alcohol-based hand sanitizer when soap isn’t available
    • Cover coughs and sneezes with a tissue or your elbow
  • Healthy Lifestyle

    • Don’t smoke and avoid secondhand smoke
    • Eat a balanced diet rich in fruits and vegetables
    • Get regular exercise and adequate sleep
  • Reduce Exposure

    • Avoid close contact with people who are sick
    • Wear a mask in crowded or poorly ventilated areas if you’re at high risk

Treatment Overview

Treatment depends on the type and severity of pneumonia:

  • Bacterial Pneumonia

    • Oral or intravenous antibiotics
    • Rest, fluids and fever-reducing medications
  • Viral Pneumonia

    • Antiviral medications (for flu or COVID-19, when appropriate)
    • Supportive care: hydration, rest, oxygen therapy if needed
  • Fungal Pneumonia

    • Antifungal medications in higher-risk patients

Always follow your healthcare provider’s instructions—finishing the full course of any prescribed antibiotic or antiviral is crucial.

When to Seek Immediate Medical Attention

Pneumonia can escalate quickly. Seek urgent care or call emergency services if you experience:

  • Difficulty breathing or shortness of breath at rest
  • Chest pain that’s severe or getting worse
  • New confusion or inability to rouse
  • Bluish lips or face
  • Persistent high fever (above 103°F/39.4°C)

For less severe symptoms, speak to a doctor or consider a free, online symptom check, using the doctor approved Ubie Symptom Checker to guide your next steps.

Key Takeaways

  • “How do you get pneumonia?” Answer: Germs enter your lungs via droplets, aspiration, bloodstream or hospital settings.
  • Pneumonia can be bacterial, viral, fungal or aspiration-related.
  • Bacterial and viral pneumonia are contagious; fungal and aspiration types usually are not.
  • Prevention includes vaccines, hand hygiene, healthy habits and avoiding sick contacts.
  • Treatment varies by cause—antibiotics for bacteria, antivirals for viruses, antifungals for fungi.
  • Always consult a doctor for a proper diagnosis and follow-up care.

Speak to a healthcare professional if you notice worrying symptoms or if you belong to a high-risk group. Early diagnosis and treatment are key to a full recovery. And if you’re still unsure about your symptoms, you can do a free, online symptom check, using the doctor approved Ubie Symptom Checker.

(References)

  • * Samitova ER, Ermak TN, Koltunov IE, Kislyakov AN, Karazhas NV, Rybalkina TN, Kornienko MY. [Intrauterine Pneumocystis infection]. Ter Arkh. 2016;88(11):99-102. doi: 10.17116/terarkh2016881199-102. PMID: 28005039.

  • * Hooven TA, Polin RA. Pneumonia. Semin Fetal Neonatal Med. 2017 Aug;22(4):206-213. doi: 10.1016/j.siny.2017.03.002. Epub 2017 Mar 24. PMID: 28343909; PMCID: PMC7270051.

  • * Li Q, Guan X, Wu P, Wang X, Zhou L, Tong Y, Ren R, Leung KSM, Lau EHY, Wong JY, Xing X, Xiang N, Wu Y, Li C, Chen Q, Li D, Liu T, Zhao J, Liu M, Tu W, Chen C, Jin L, Yang R, Wang Q, Zhou S, Wang R, Liu H, Luo Y, Liu Y, Shao G, Li H, Tao Z, Yang Y, Deng Z, Liu B, Ma Z, Zhang Y, Shi G, Lam TTY, Wu JT, Gao GF, Cowling BJ, Yang B, Leung GM, Feng Z. Early Transmission Dynamics in Wuhan, China, of Novel Coronavirus-Infected Pneumonia. N Engl J Med. 2020 Mar 26;382(13):1199-1207. doi: 10.1056/NEJMoa2001316. Epub 2020 Jan 29. PMID: 31995857; PMCID: PMC7121484.

  • * Wu YC, Chen CS, Chan YJ. The outbreak of COVID-19: An overview. J Chin Med Assoc. 2020 Mar;83(3):217-220. doi: 10.1097/JCMA.0000000000000270. PMID: 32134861; PMCID: PMC7153464.

  • * Chow VLY, Chan JYW, Ho VWY, Pang SSY, Lee GCC, Wong MMK, Lo ASH, Lui F, Poon CCM, Wong STS. Tracheostomy during COVID-19 pandemic-Novel approach. Head Neck. 2020 Jul;42(7):1367-1373. doi: 10.1002/hed.26234. Epub 2020 May 6. PMID: 32358855; PMCID: PMC7267533.

  • * Vivanti AJ, Vauloup-Fellous C, Prevot S, Zupan V, Suffee C, Do Cao J, Benachi A, De Luca D. Transplacental transmission of SARS-CoV-2 infection. Nat Commun. 2020 Jul 14;11(1):3572. doi: 10.1038/s41467-020-17436-6. Epub 2020 Jul 14. PMID: 32665677; PMCID: PMC7360599.

  • * Naidu SAG, Clemens RA, Pressman P, Zaigham M, Davies KJA, Naidu AS. COVID-19 during Pregnancy and Postpartum. J Diet Suppl. 2022;19(1):78-114. doi: 10.1080/19390211.2020.1834047. Epub 2020 Nov 8. PMID: 33164606.

  • * Mattar CN, Kalimuddin S, Sadarangani SP, Tagore S, Thain S, Thoon KC, Hong EY, Kanneganti A, Ku CW, Chan GM, Lee KZ, Yap JJ, Tan SS, Yan B, Young BE, Lye DC, Anderson DE, Yang L, Su LL, Somani J, Tan LK, Choolani MA, Chan JK. Pregnancy Outcomes in COVID-19: A Prospective Cohort Study in Singapore. Ann Acad Med Singap. 2020 Nov;49(11):857-869. doi: 10.47102/annals-acadmedsg.2020437. PMID: 33381779.

  • * Metlay JP, Haas JS, Soltoff AE, Armstrong KA. Household Transmission of SARS-CoV-2. JAMA Netw Open. 2021 Feb 1;4(2):e210304. doi: 10.1001/jamanetworkopen.2021.0304. Epub 2021 Feb 1. PMID: 33635324; PMCID: PMC7910814.

  • * Wang CC, Prather KA, Sznitman J, Jimenez JL, Lakdawala SS, Tufekci Z, Marr LC. Airborne transmission of respiratory viruses. Science. 2021 Aug 27;373(6558). doi: 10.1126/science.abd9149. PMID: 34446582; PMCID: PMC8721651.

Thinking about asking ChatGPT?Ask me instead

Tell your friends about us.

We would love to help them too.

smily Shiba-inu looking

For First Time Users

What is Ubie’s Doctor’s Note?

We provide a database of explanations from real doctors on a range of medical topics. Get started by exploring our library of questions and topics you want to learn more about.

Was this page helpful?

Purpose and positioning of servicesUbie Doctor's Note is a service for informational purposes. The provision of information by physicians, medical professionals, etc. is not a medical treatment. If medical treatment is required, please consult your doctor or medical institution. We strive to provide reliable and accurate information, but we do not guarantee the completeness of the content. If you find any errors in the information, please contact us.