Pneumonia is an infection that fills your lungs with fluid or pus

Pneumonia is a lung infection caused by bacteria, viruses, or fungi. When you have pneumonia, the air sacs in your lungs (called alveoli) fill with fluid or pus instead of air. This makes it harder for oxygen to reach your bloodstream, which is why pneumonia can make you feel very sick and short of breath.

Pneumonia can develop on its own or after another illness like the flu or a cold. Some people get pneumonia after being in the hospital or using a ventilator. Others catch it from breathing in infected droplets when someone nearby coughs or sneezes. The severity ranges from mild (sometimes called "walking pneumonia") to severe enough to require hospitalization.

Key Takeaways

  • Pneumonia fills your lungs with fluid or pus, making it hard for oxygen to enter your blood.
  • Bacteria, viruses, and fungi can all cause pneumonia, and the type matters because treatment differs.
  • Doctors diagnose pneumonia using a chest X-ray, blood tests, or sometimes a sputum culture to identify what is causing it.
  • Symptoms include cough, fever, shortness of breath, and chest pain, and they can develop suddenly or gradually over days.
  • Treatment depends on the cause: antibiotics for bacterial pneumonia, supportive care for viral pneumonia, and antifungal medication for fungal pneumonia.

The three main types of pneumonia and what causes them

Bacterial pneumonia is the most common type in adults. Streptococcus pneumoniae is the most frequent culprit, though other bacteria like Haemophilus influenzae and Legionella can also cause it. Bacterial pneumonia often comes on suddenly and tends to be more severe than viral pneumonia.

Viral pneumonia is usually milder and develops more slowly. Respiratory syncytial virus (RSV), influenza, and coronaviruses (including SARS-CoV-2) are common causes. Viral pneumonia often follows a cold or flu, and your body's own immune system does most of the fighting—antibiotics do not work against viruses.

Fungal pneumonia is less common and usually affects people with weakened immune systems, such as those with HIV/AIDS or those taking immunosuppressant medications. Histoplasmosis and coccidioidomycosis are examples. Fungal pneumonia requires specific antifungal treatment.

A fourth category, aspiration pneumonia, occurs when you breathe in food, saliva, or stomach contents instead of air. This can happen if you have trouble swallowing or if you are sedated. The material can carry bacteria into your lungs and cause infection.

Symptoms that suggest you might have pneumonia

The most common symptom is a cough that may be dry at first or produce mucus (sputum). You may also have a fever, sometimes quite high. Many people experience shortness of breath, even when resting, and chest pain that worsens when you breathe deeply or cough.

Other symptoms include fatigue, chills, headache, and muscle aches. Some people feel confused or disoriented, especially older adults. In children, pneumonia may cause rapid or difficult breathing, and they may refuse to eat or drink.

Symptoms can appear suddenly (over hours) or develop gradually over several days. Viral pneumonia symptoms often resemble a bad cold or flu at first, while bacterial pneumonia tends to hit harder and faster. If you have persistent cough, fever, or shortness of breath lasting more than a week, or if you feel very ill, contact your doctor or seek urgent care.

How doctors diagnose pneumonia

Your doctor will start by listening to your lungs with a stethoscope. Pneumonia often produces abnormal sounds called crackles or wheezes. They will also ask about your symptoms, when they started, and whether you have been around anyone who is sick.

A chest X-ray is the standard test to confirm pneumonia. It shows areas of your lungs filled with fluid or pus, which appear as white patches on the image. The X-ray also helps your doctor see how much of your lungs are affected and whether both lungs or just one are involved.

Your doctor may order blood tests to check your white blood cell count (which rises during infection) and to look for signs of bacterial infection. If your symptoms are severe or you are hospitalized, they may take a sputum sample (mucus you cough up) to identify exactly which bacteria, virus, or fungus is causing the infection. This helps them choose the right treatment.

In some cases, especially for hospitalized patients, a CT scan or bronchoscopy (a thin tube passed down your airway to look directly at your lungs) may be needed to get more detail or to rule out other conditions.

Risk factors that make pneumonia more likely

Age matters: pneumonia is more common and more serious in people over 65 and in infants under 2 years old. Smoking damages your lungs' ability to clear infection, so smokers are at higher risk. Chronic lung diseases like asthma, COPD, or cystic fibrosis make pneumonia more likely.

A weakened immune system increases your risk significantly. This includes people with HIV/AIDS, those taking immunosuppressant drugs after an organ transplant, and people undergoing chemotherapy. Recent surgery, prolonged bed rest, or being on a ventilator in the hospital also raises your risk.

Other conditions that increase risk include heart disease, diabetes, kidney disease, and liver disease. Alcohol misuse weakens immune function. Recent viral infections like the flu or COVID-19 can leave your lungs vulnerable to bacterial pneumonia. If you fall into any of these categories, talk to your doctor about prevention strategies like vaccines.

Treatment depends on what is causing your pneumonia

Bacterial pneumonia is treated with antibiotics. Your doctor will choose an antibiotic based on the most likely bacteria or, if a sputum culture was done, based on what was actually found. Common choices include amoxicillin, azithromycin, or fluoroquinolones. You usually take antibiotics by mouth at home, though hospitalized patients may receive them intravenously. It is important to finish the full course even if you feel better.

Viral pneumonia has no specific cure—your immune system fights the infection while you rest and recover. Treatment focuses on managing symptoms: fever reducers, cough medicine, and staying hydrated. Antiviral medications exist for some viruses (like influenza or COVID-19) but work best if started early. Most people recover in two to three weeks, though fatigue can linger.

Fungal pneumonia requires antifungal medications, often taken for weeks or months. These are prescribed only after the specific fungus is identified.

Regardless of the cause, supportive care is essential: rest, fluids, and oxygen if your blood oxygen level is low. Your doctor may recommend over-the-counter pain relievers for chest pain and fever. If you are hospitalized, you will receive oxygen therapy, intravenous fluids, and close monitoring. Most people treated as outpatients recover at home within one to three weeks, though a lingering cough can persist for months.

When to seek medical care and what to expect next

Contact your doctor if you have a cough lasting more than a week, fever above 100.4°F (38°C), or shortness of breath. Seek urgent care or go to the emergency room if you have severe difficulty breathing, chest pain, confusion, or if you cough up blood. Older adults, very young children, and people with chronic illnesses should contact their doctor sooner rather than later.

After diagnosis, your doctor will discuss treatment options based on what type of pneumonia you have. If you are treated at home, you will need to rest, take medications as prescribed, and watch for worsening symptoms. Follow-up appointments are common to make sure you are improving. A repeat chest X-ray may be done after treatment to confirm the infection has cleared, especially if you are a smoker or have chronic lung disease.

Recovery time varies. Mild pneumonia may resolve in one to two weeks with treatment. Severe pneumonia, especially in older adults or those with other health conditions, can take several weeks or longer. Some people experience lingering fatigue or a persistent cough for months after the infection clears.

Frequently Asked Questions

Can you catch pneumonia from someone else?

You can catch the infection that causes pneumonia (like a cold or flu virus), but pneumonia itself is not directly contagious. Someone with pneumonia can spread the underlying virus or bacteria through coughs and sneezes, and that infection may develop into pneumonia in another person, especially if they have risk factors.

Is pneumonia always serious?

Pneumonia ranges from mild to life-threatening. "Walking pneumonia" (usually viral or mild bacterial) may feel like a bad cold and resolve on its own. Severe pneumonia can cause sepsis, organ failure, and death, especially in older adults or those with weakened immune systems. Age, overall health, and how much of your lungs are affected determine severity.

How long does it take to recover from pneumonia?

Mild pneumonia often improves within one to two weeks of treatment. Severe pneumonia may take several weeks or longer. Even after the infection clears, fatigue and a lingering cough are common for weeks or months. Your doctor can tell you what to expect based on your specific situation.

Can pneumonia come back?

Yes, you can get pneumonia more than once. Having pneumonia once does not make you immune. People with chronic lung disease, smokers, and older adults are at higher risk for recurrent pneumonia. Vaccines and preventive measures like quitting smoking and getting flu shots can reduce your risk.

What is the difference between pneumonia and bronchitis?

Bronchitis is inflammation of the tubes that carry air to your lungs (bronchi), while pneumonia is infection in the air sacs themselves. Bronchitis usually causes a cough and mucus but does not fill your lungs with fluid. Pneumonia causes more severe symptoms and shows up on a chest X-ray. Bronchitis often resolves on its own; pneumonia usually requires treatment.