Doctors Note Logo

Published on: 1/20/2026

How do you get pneumonia?

Pneumonia happens when germs infect the air sacs in your lungs, most commonly after breathing in infected droplets, accidentally aspirating saliva or food, or less often when another infection spreads through the bloodstream. Risk is higher in young children, adults over 65, smokers, people with chronic heart, lung, or metabolic disease, weakened immunity, or recent viral illness like flu; there are several factors to consider. See below for key details on risks, prevention, symptoms, and when to seek care that could affect your next steps.

answer background

Explanation

How Do You Get Pneumonia?

Pneumonia is an infection of the lungs that causes inflammation in the air sacs (alveoli). It can range from mild to severe and affects people of all ages. Understanding how pneumonia develops and what increases your risk can help you take steps to protect yourself and those you care about.

Common Ways Pneumonia Develops

  1. Inhalation of Infectious Droplets

    • When someone with a respiratory infection (like bacterial pneumonia or the flu) coughs or sneezes, tiny droplets containing germs are released into the air.
    • If you breathe in these droplets, the pathogens can travel down your airways and infect the alveoli.
  2. Aspiration of Oropharyngeal Contents

    • Small amounts of saliva, food, or liquid from your mouth and throat can accidentally enter your lungs, especially if your swallowing reflexes are weak.
    • These materials often carry bacteria that normally live in the mouth, leading to aspiration pneumonia.
  3. Spread from Nearby Infections

    • An infection in another part of the body (for example, a severe sinus or ear infection) can sometimes spread to the lungs through the bloodstream.
  4. Reduced Immune Defenses

    • When your body’s normal defenses are weakened—by illness, medications, or certain medical treatments—bacteria or viruses that usually stay in check can multiply and cause pneumonia.

Major Types of Pneumonia

  • Community-Acquired Pneumonia (CAP)
    Acquired outside of a hospital or health care setting. Common causes include:

    • Streptococcus pneumoniae (most common bacterial cause)
    • Influenza viruses and other respiratory viruses
    • Mycoplasma pneumoniae (“walking pneumonia”)
  • Hospital-Acquired Pneumonia (HAP)
    Develops 48+ hours after admission to a hospital. Often involves more resistant bacteria (e.g., Staphylococcus aureus).

  • Healthcare-Associated Pneumonia (HCAP)
    Occurs in people with frequent contact with healthcare facilities (dialysis centers, nursing homes). Risk of antibiotic-resistant organisms is higher.

  • Aspiration Pneumonia
    Results from inhaling foreign material (food, liquids, vomit). More common in patients with swallowing difficulties, altered consciousness, or reflux.

Who Is at Higher Risk?

While anyone can get pneumonia, certain factors increase susceptibility. Almirall and Bolíbar’s study (J Clin Epidemiol, 2008) identified key risk factors for community-acquired pneumonia in adults:

  • Age
    • Children under 2 years old
    • Adults over 65 years old

  • Chronic Diseases
    • Chronic obstructive pulmonary disease (COPD)
    • Asthma
    • Heart disease (congestive heart failure)
    • Diabetes mellitus
    • Kidney or liver disease

  • Lifestyle Factors
    • Smoking tobacco or vaping
    • Excessive alcohol use
    • Poor nutrition or dehydration

  • Immunosuppression
    • HIV infection
    • Chemotherapy or radiation therapy
    • Long-term corticosteroid use
    • Organ transplant recipients

  • Recent Respiratory Viral Infection
    • Influenza or other upper respiratory infections can damage airway defenses, allowing bacterial overgrowth.

  • Environmental Exposures
    • Living in crowded settings (dormitories, shelters)
    • Working in environments with pollutants or dust

How Pathogens Reach the Lungs

  1. Attachment and Colonization

    • Pathogens enter your nose or mouth and begin to multiply on the mucous membranes.
  2. Evasion of Defenses

    • Normally, tiny hairs (cilia) and mucus trap and clear germs.
    • Smoking, air pollution, or viral infections can impair these barriers.
  3. Invasion of Alveoli

    • Bacteria or viruses travel deeper into the airways until they reach the alveoli.
    • Once in the alveoli, they trigger an immune response.
  4. Inflammation and Fluid Buildup

    • White blood cells rush to the infection site, causing redness and swelling.
    • Fluid and pus fill the alveoli, making it hard for oxygen to pass into the bloodstream.

Symptoms to Watch For

Pneumonia symptoms can develop suddenly or over several days. They vary depending on the cause and your overall health:

  • Cough (often productive, with green or yellow phlegm)
  • Fever and chills
  • Shortness of breath or rapid breathing
  • Chest pain that worsens when you breathe or cough
  • Fatigue and muscle aches
  • Confusion or changes in mental awareness (especially in older adults)
  • Nausea, vomiting, or diarrhea (occasionally)

If you’re concerned about your symptoms, consider doing a free, online symptom check for to get personalized guidance on whether you should seek medical attention.

Prevention Tips

While not all cases of pneumonia can be prevented, you can reduce your risk:

  • Vaccination
    • Pneumococcal vaccines protect against the most common bacterial strains.
    • Annual flu shots reduce the risk of secondary bacterial pneumonia after the flu.

  • Good Respiratory Hygiene
    • Cover your mouth and nose when coughing or sneezing.
    • Wash your hands frequently with soap and water.

  • Healthy Lifestyle
    • Don’t smoke and avoid secondhand smoke.
    • Eat a balanced diet rich in fruits, vegetables, and whole grains.
    • Stay active to keep your lungs strong.

  • Manage Chronic Conditions
    • Keep diabetes, asthma, and heart disease under control with your doctor’s help.
    • Follow prescribed treatments and attend regular check-ups.

  • Safe Swallowing Practices
    • If you have swallowing problems, work with a speech therapist or dietitian.
    • Sit upright while eating and chew food thoroughly.

When to See a Doctor

Pneumonia can become life-threatening, especially in high-risk groups. Seek immediate medical care if you experience:

  • Difficulty breathing (shortness of breath at rest)
  • Chest pain that worsens with breathing
  • High fever (over 102°F/39°C) or persistent fever lasting more than three days
  • Confusion, drowsiness, or difficulty waking
  • Bluish lips or fingernails (sign of low oxygen)
  • Signs of dehydration (dry mouth, dizziness, little urine output)

Even if symptoms seem mild, talk to your doctor if you have risk factors such as age over 65, a chronic illness, or a weakened immune system.

Key Takeaways

  • Pneumonia develops when bacteria, viruses, or other organisms overwhelm the lungs’ defenses.
  • You can get it by inhaling infected droplets, aspirating oropharyngeal material, or through bloodstream spread.
  • Certain groups—young children, older adults, smokers, and those with chronic diseases—are at higher risk.
  • Vaccines, good hand hygiene, and a healthy lifestyle help prevent many cases.
  • Always discuss serious or persistent symptoms with your healthcare provider.

If you’re unsure whether your symptoms could be pneumonia, please consider doing a free, online symptom check for pneumonia and follow up with a medical professional. For any life-threatening or serious concerns, speak to a doctor right away.

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.