You get pneumonia when a pathogen or irritant reaches the tiny air sacs deep in your lungs and triggers inflammation that fills them with fluid. This can happen through several routes: breathing in infected droplets from a cough or sneeze, accidentally inhaling saliva or food into the lungs, or picking up fungal spores from contaminated soil. The specific cause varies, but the end result is the same. Your lungs partially fill with fluid and immune cells, making it harder to get oxygen into your bloodstream.
What Happens Inside Your Lungs
Your lungs contain millions of tiny air sacs called alveoli, where oxygen passes into your blood. Normally, your body has several lines of defense that keep pathogens out: nose hairs filter large particles, mucus traps smaller ones, and tiny hair-like structures called cilia sweep debris back up toward your throat. When a germ slips past all of these defenses and reaches the alveoli, your immune system sends a flood of white blood cells to fight it off.
That immune response is what actually makes you sick. The rush of white blood cells and the fluid they bring with them fill the air sacs, which is why pneumonia causes coughing, difficulty breathing, and sometimes a crackling sound when you inhale. If your immune system clears the infection quickly, the fluid reabsorbs and you recover. If the infection persists, your body shifts to a containment strategy, walling off the pathogen in clusters of immune cells rather than eliminating it outright. This is more common in people with weakened immune systems.
Three Ways Pathogens Reach Your Lungs
Breathing In Infected Droplets
The most familiar route is inhalation. When someone with a respiratory infection coughs, sneezes, or talks, they release tiny droplets containing bacteria or viruses. If you breathe those in, the pathogens can travel down your airways and settle in the alveoli. This is how most cases of community-acquired pneumonia happen, meaning infections picked up in everyday life rather than in a hospital.
Aspiration
Aspiration pneumonia develops when something other than air enters your lungs. This can include saliva, mucus, stomach acid, vomit, food, beverages, or even small objects. Everyone aspirates tiny amounts of saliva during sleep, but a healthy body clears it easily. The risk climbs sharply when something interferes with your ability to swallow or cough. People who have had a stroke, brain injury, or neurological conditions like Parkinson’s disease or multiple sclerosis face higher risk because these conditions impair the swallowing reflex. The same goes for people under general anesthesia, those impaired by alcohol or drugs, and people over 65 or under 5. Chronic acid reflux also increases the danger because it repeatedly pushes stomach acid toward the throat, where it can be inhaled.
Fungal Spores From the Environment
Some types of pneumonia come not from other people but from the environment itself. Histoplasmosis, for example, is a lung infection caused by breathing in spores of a fungus that lives in soil, particularly soil enriched by bird or bat droppings. People who work in construction, demolition, farming, or cave exploration are more likely to disturb contaminated soil and inhale these spores. Other fungi found in certain regions of the United States can cause similar infections.
Bacteria, Viruses, and Fungi
Bacterial pneumonia is the most common type in adults. The leading culprit is Streptococcus pneumoniae, the bacterium behind what’s often called pneumococcal disease. Other bacteria that commonly cause it include Haemophilus influenzae, Chlamydia pneumoniae, and Legionella, which causes Legionnaires’ disease (typically contracted by inhaling mist from contaminated water systems, not from person-to-person contact).
Viruses that cause the common cold, the flu, COVID-19, and RSV can all lead to pneumonia, particularly when the initial infection weakens the lungs enough for bacteria to gain a foothold. Viral pneumonia tends to start gradually and may feel like a worsening cold or flu that moves into your chest.
Fungal pneumonia is less common overall but affects certain groups disproportionately, especially people with weakened immune systems and those who live or work in areas where specific fungi are prevalent in the soil.
Where You Get Infected Matters
Pneumonia picked up in daily life, called community-acquired pneumonia, tends to involve different germs than pneumonia contracted in a hospital or healthcare facility. Hospital-acquired pneumonia develops at least 48 hours after a hospital admission and often involves bacteria that are more resistant to antibiotics. Healthcare-associated pneumonia affects people with recent or chronic contact with the healthcare system, including those living in nursing homes or long-term care facilities, and those receiving treatments like dialysis. These infections tend to behave more like hospital-acquired pneumonia than the community-acquired type.
Who Is Most Vulnerable
Age is one of the strongest risk factors, and it works at both ends of the spectrum. Children under 2 have immune systems that don’t yet respond effectively to certain bacterial coatings, which is why they need a specific type of vaccine that trains their immune cells through a different pathway. Adults over 65 face a different problem: aging gradually weakens both branches of the immune system, reducing the body’s ability to produce targeted antibodies and expand the immune cells needed to fight off infection. Frailty, rather than age alone, appears to be a better predictor of how well an older person’s immune system can respond.
Chronic conditions significantly raise your risk. Heart disease, liver disease, lung diseases like COPD and asthma, and diabetes all make it harder for your body to fight respiratory infections. People with weakened immune systems, whether from a medical condition or from medications that suppress immunity, face the greatest risk of all.
How Smoking and Vaping Damage Lung Defenses
Smoking damages the cilia that sweep pathogens out of your airways, essentially disabling one of the lungs’ primary cleaning mechanisms. Vaping causes a different but equally concerning type of damage. Nicotine from e-cigarettes disrupts the tight junctions between the cells lining your airways. These junctions normally form a barrier that helps keep viruses and bacteria from penetrating deeper into lung tissue. Research on human airway cells found that exposure to aerosolized nicotine from e-cigarettes followed by exposure to RSV caused a twofold increase in infection compared to cells exposed to clean air. This barrier damage occurs even at nicotine levels that don’t cause obvious cell death, meaning the lungs can look fine while their defenses are quietly compromised. Once that barrier is disrupted, bacterial pneumonia becomes more likely too.
Pneumonia Vaccines
Vaccination is the most effective way to prevent pneumococcal pneumonia specifically. The CDC recommends a four-dose series for all children under 5, given at 2, 4, 6, and 12 to 15 months of age. For adults 50 and older who have never received a pneumococcal conjugate vaccine, the current recommendation is one dose of PCV15, PCV20, or PCV21. If PCV20 or PCV21 is used, no additional doses are needed. If PCV15 is used, a follow-up dose of a different vaccine (PPSV23) is recommended about a year later.
Staying current on flu and COVID-19 vaccines also reduces your pneumonia risk indirectly, since viral respiratory infections often pave the way for bacterial pneumonia to develop. For people with conditions that affect swallowing, managing those underlying problems, including chronic acid reflux, is an important preventive step.