Pneumonia is an infection caused by bacteria, viruses, or fungi. It leads to inflammation in the air sacs of one or both lungs. These sacs, called alveoli, fill with fluid or pus, making it difficult to breathe.

Both viral and bacterial pneumonia is contagious. This means they can spread from person to person through inhalation of airborne droplets from a sneeze or cough.

You can also get these types of pneumonia by coming into contact with surfaces or objects that are contaminated with pneumonia-causing bacteria or viruses.

You can contract fungal pneumonia from the environment. It does not spread from person to person.

Pneumonia is further classified according to where or how it was acquired:

  • Hospital-acquired pneumonia (HAP). This type of bacterial pneumonia is acquired during a hospital stay. It can be more serious than other types, as the bacteria involved may be more resistant to antibiotics.
  • Community-acquired pneumonia (CAP). This refers to pneumonia that’s acquired outside of a medical or institutional setting.
  • Ventilator-associated pneumonia (VAP). When people who are using a ventilator get pneumonia, it’s called VAP.
  • Aspiration pneumonia. Inhaling bacteria into your lungs from food, drink, or saliva can cause aspiration pneumonia. It’s more likely to occur if you have a swallowing problem, or if you’re too sedated from the use of medications, alcohol, or other drugs.

Walking pneumonia

Walking pneumonia is a milder case of pneumonia. People with walking pneumonia may not even know they have pneumonia. Their symptoms may feel more like a mild respiratory infection than pneumonia. However, walking pneumonia may require a longer recovery period.

The symptoms of walking pneumonia can include things like:

  • mild fever
  • dry cough lasting longer than a week
  • chills
  • shortness of breath
  • chest pain
  • reduced appetite

Viruses and bacteria, like Streptococcus pneumoniae or Haemophilus influenzae, often cause pneumonia. However, in walking pneumonia, the bacteria Mycoplasma pneumoniae most commonly causes the condition.

Pneumonia may be classified based off the area of the lungs it’s affecting:

Bronchopneumonia

Bronchopneumonia can affect areas throughout both of your lungs. It’s often localized close to or around your bronchi. These are the tubes that lead from your windpipe to your lungs.

Lobar pneumonia

Lobar pneumonia affects one or more lobes of your lungs. Each lung is made of lobes, which are defined sections of the lung.

Lobar pneumonia can be further divided into four stages based off how it’s progressed:

  • Congestion. Lung tissue appears heavy and congested. Fluid filled with infectious organisms has accumulated in the air sacs.
  • Red hepatization. Red bloods cells and immune cells have entered into the fluid. This makes the lungs appear red and solid in appearance.
  • Gray hepatization. The red blood cells have begun to break down while immune cells remain. The breakdown of red blood cells causes a change in color, from red to gray.
  • Resolution. Immune cells have begun to clear the infection. A productive cough helps eject remaining fluid from the lungs.

Pneumonia symptoms can be mild to life threatening. They can include:

  • coughing that may produce phlegm (mucus)
  • fever
  • sweating or chills
  • shortness of breath that happens while doing normal activities, or even while resting
  • chest pain that’s worse when you breathe or cough
  • feelings of tiredness or fatigue
  • loss of appetite
  • nausea or vomiting
  • headaches

Other symptoms can vary according to your age and general health:

  • Infants may appear to have no symptoms, but sometimes they may vomit, lack energy, or have trouble drinking or eating.
  • Children under 5 years old may have fast breathing or wheezing.
  • Older adults may have milder symptoms. They can also experience confusion or a lower-than-normal body temperature.

Pneumonia happens when germs get into your lungs and cause an infection. The immune system’s reaction to clear the infection results in inflammation of the lung’s air sacs (alveoli). This inflammation can eventually cause the air sacs to fill up with pus and liquids, causing pneumonia symptoms.

Several types of infectious agents can cause pneumonia, including bacteria, viruses, and fungi.

Bacterial pneumonia

The most common cause of bacterial pneumonia is Streptococcus pneumoniae. Other causes include:

Viral pneumonia

Respiratory viruses are often the cause of pneumonia. Examples of viral infections that can cause pneumonia include:

Although the symptoms of viral and bacterial pneumonia are very similar, viral pneumonia is usually milder. It can improve in 1 to 3 weeks without treatment.

According to the National Heart, Lung, and Blood Institute, people with viral pneumonia are at risk of developing bacterial pneumonia.

Fungal pneumonia

Fungi from soil or bird droppings can cause pneumonia. They most often cause pneumonia in people with weakened immune systems. Examples of fungi that can cause pneumonia include:

  • Pneumocystis jirovecii
  • Cryptococcus species
  • Histoplasmosis species
  • Coccidioides species

Risk factors

Anyone can get pneumonia, but certain groups do have a higher risk. These groups include:

  • infants from birth to 2 years old
  • people ages 65 and older
  • people with weakened immune systems due to:
    • pregnancy
    • HIV
    • the use of certain medications, such as steroids or certain cancer drugs
  • people with certain chronic medical conditions, such as:
  • people who’ve been recently or are currently hospitalized, particularly if they were or are on a ventilator
  • people who’ve had a brain disorder, which can affect the ability to swallow or cough, such as:
    • stroke
    • head injury
    • dementia
    • Parkinson’s disease
  • people who’ve been regularly exposed to lung irritants, such as air pollution and toxic fumes, especially on the job
  • people who live in a crowded living environment, such as a prison or nursing home
  • people who smoke, which makes it more difficult for the body to get rid of mucus in the airways
  • people who use drugs or drink heavy amounts of alcohol, which weakens the immune system and increases the odds of inhaling saliva or vomit into the lungs due to sedation

Your doctor will start by taking your medical history. They’ll ask you questions about when your symptoms first appeared and your health in general.

They’ll then give you a physical exam. This will include listening to your lungs with a stethoscope for any abnormal sounds, such as crackling.

Depending on the severity of your symptoms and your risk of complications, your doctor may also order one or more of these tests:

Chest X-ray

An X-ray helps your doctor look for signs of inflammation in your chest. If inflammation is present, the X-ray can also inform your doctor about its location and extent.

Blood culture

This test uses a blood sample to confirm an infection. Culturing can also help identify what may be causing your condition.

Sputum culture

During a sputum culture, a sample of mucus is collected after you’ve coughed deeply. It’s then sent to a lab to be analyzed to identify the cause of the infection.

Pulse oximetry

A pulse oximetry measures the amount of oxygen in your blood. A sensor placed on one of your fingers can indicate whether your lungs are moving enough oxygen through your bloodstream.

CT scan

CT scans provide a clearer and more detailed picture of your lungs.

Fluid sample

If your doctor suspects there’s fluid in the pleural space of your chest, they may take a fluid sample using a needle placed between your ribs. This test can help identify the cause of your infection.

Bronchoscopy

A bronchoscopy looks into the airways in your lungs. It does this using a camera on the end of a flexible tube that’s gently guided down your throat and into your lungs.

Your doctor may do this test if your initial symptoms are severe, or if you’re hospitalized and not responding well to antibiotics.

Your treatment will depend on the type of pneumonia you have, how severe it is, and your general health.

Prescription medications

Your doctor may prescribe a medication to help treat your pneumonia. What you’re prescribed will depend on the specific cause of your pneumonia.

Oral antibiotics can treat most cases of bacterial pneumonia. Always take your entire course of antibiotics, even if you begin to feel better. Not doing so can prevent the infection from clearing, and it may be harder to treat in the future.

Antibiotic medications don’t work on viruses. In some cases, your doctor may prescribe an antiviral. However, many cases of viral pneumonia clear on their own with at-home care.

Antifungal medications are used to treat fungal pneumonia. You may have to take this medication for several weeks to clear the infection.

OTC medications

Your doctor may also recommend over-the-counter (OTC) medications to relieve your pain and fever, as needed. These may include:

Your doctor may also recommend cough medicine to calm your cough so you can rest. Keep in mind coughing helps remove fluid from your lungs, so you don’t want to eliminate it entirely.

Home remedies

Although home remedies don’t actually treat pneumonia, there are some things you can do to help ease symptoms.

Coughing is one of the most common symptoms of pneumonia. Natural ways to relieve a cough include gargling salt water or drinking peppermint tea.

Cool compresses can work to relieve a fever. Drinking warm water or having a nice warm bowl of soup can help with chills. Here are more home remedies to try.

You can help your recovery and prevent a recurrence by getting a lot of rest and drinking plenty of fluids.

Although home remedies can help ease symptoms, it’s important to stick to your treatment plan. Take any prescribed medications as directed.

Hospitalization

If your symptoms are very severe or you have other health problems, you may need to be hospitalized. At the hospital, doctors can keep track of your heart rate, temperature, and breathing. Hospital treatment may include:

  • antibiotics injected into a vein
  • respiratory therapy, which involves delivering specific medications directly into the lungs, or teaching you to perform breathing exercises to maximize your oxygenation
  • oxygen therapy to maintain oxygen levels in your bloodstream (received through a nasal tube, face mask, or ventilator, depending on severity)

Pneumonia may cause complications, especially in people with weakened immune systems or chronic conditions, such as diabetes.

Complications may include:

  • Worsened chronic conditions. If you have certain preexisting health conditions, pneumonia could make them worse. These conditions include congestive heart failure and emphysema. For certain people, pneumonia increases their risk of having a heart attack.
  • Bacteremia. Bacteria from the pneumonia infection may spread to your bloodstream. This can lead to dangerously low blood pressure, septic shock, and, in some cases, organ failure.
  • Lung abscesses. These are cavities in the lungs that contain pus. Antibiotics can treat them. Sometimes they may require drainage or surgery to remove the pus.
  • Impaired breathing. You may have trouble getting enough oxygen when you breathe. You may need to use a ventilator.
  • Acute respiratory distress syndrome. This is a severe form of respiratory failure. It’s a medical emergency.
  • Pleural effusion. If your pneumonia isn’t treated, you may develop fluid around your lungs in your pleura, called pleural effusion. The pleura are thin membranes that line the outside of your lungs and the inside of your rib cage. The fluid may become infected and need to be drained.
  • Kidney, heart, and liver damage. These organs may be damaged if they don’t receive enough oxygen, or if there’s an overreaction of the immune system to the infection.
  • Death. In some cases, pneumonia can be fatal. According to the CDC, nearly 44,000 people in the United States died from pneumonia in 2019.

In many cases, pneumonia can be prevented.

Vaccination

The first line of defense against pneumonia is to get vaccinated. There are several vaccines that can help prevent pneumonia.

Prevnar 13 and Pneumovax 23

These two pneumonia vaccines help protect against pneumonia and meningitis caused by pneumococcal bacteria. Your doctor can tell you which one might be better for you.

Prevnar 13 is effective against 13 types of pneumococcal bacteria. The CDC recommends this vaccine for:

  • children under age 2
  • people between ages 2 and 64 with chronic conditions that increase their risk of pneumonia
  • adults ages 65 and older, on the recommendation of their doctor

Pneumovax 23 is effective against 23 types of pneumococcal bacteria. The CDC recommends it for:

  • adults ages 65 and older
  • adults ages 19 to 64 who smoke
  • people between ages 2 and 64 with chronic conditions that increase their risk of pneumonia

Flu vaccine

Pneumonia can often be a complication of the flu, so be sure to also get an annual flu shot. The CDC recommends that everyone ages 6 months and older get vaccinated, particularly those who may be at risk of flu complications.

Covid vaccine

COVID-19 can lead to pneumonia. The CDC recommends that everyone 6 months and older should receive an updated COVID-19 vaccine.

Hib vaccine

This vaccine protects against Haemophilus influenzae type b (Hib), a type of bacterium that can cause pneumonia and meningitis. The CDC recommends this vaccine for:

  • all children under 5 years old
  • unvaccinated older children or adults who have certain health conditions
  • people who’ve gotten a bone marrow transplant

According to the National Heart, Lung, and Blood Institute, pneumonia vaccines won’t prevent all cases of the condition.

But if you’re vaccinated, you’re likely to have a milder and shorter illness as well as a lower risk of complications.

Other prevention tips

In addition to vaccination, there are other things you can do to avoid pneumonia:

  • If you smoke, try to quit. Smoking makes you more susceptible to respiratory infections, especially pneumonia.
  • Regularly wash your hands with soap and water for at least 20 seconds.
  • Cover your coughs and sneezes. Promptly dispose used tissues.
  • Maintain a healthy lifestyle to strengthen your immune system. Get enough rest, eat a balanced diet, and get regular exercise.

Together with vaccination and additional prevention steps, you can help reduce your risk of getting pneumonia. Here are even more prevention tips.

A variety of infectious agents cause pneumonia. With proper recognition and treatment, many cases of pneumonia can be cleared without complications.

For bacterial infections, stopping your antibiotics early can cause the infection to not clear completely. This means your pneumonia could come back.

Stopping antibiotics early can also contribute to antibiotic resistance. Antibiotic-resistant infections are more difficult to treat.

Viral pneumonia often resolves in 1 to 3 weeks with at-home treatment. In some cases, you may need antivirals.

Antifungal medications treat fungal pneumonia. It may require a longer period of treatment.

Pneumonia can become dangerous quickly, particularly in young children. Here’s how to avoid complications.

Most people respond to treatment and recover from pneumonia. Like your treatment, your recovery time will depend on the type of pneumonia you have, how severe it is, and your general health.

A younger person may feel back to normal in a week after treatment. Others may take longer to recover and may have lingering fatigue. If your symptoms are severe, your recovery may take several weeks.

Consider taking these steps to aid in your recovery and help prevent complications from occurring:

  • Stick to the treatment plan your doctor has developed, and take all medications as instructed.
  • Make sure to get plenty of rest to help your body fight the infection.
  • Drink plenty of fluids.
  • Ask your doctor when you should schedule a follow-up appointment. They may want to perform another chest X-ray to make sure your infection has cleared.

Pneumonia is a lung infection caused by bacteria, viruses, or fungi. The immune system’s reaction to this infection causes the lung’s air sacs to fill with pus and fluids. This leads to symptoms such as trouble breathing, a cough with or without mucus, fever, and chills.

To diagnose pneumonia, your doctor will do a physical exam and discuss your medical history. They may recommend further testing, such as a chest X-ray.

Treatment depends on the cause of the infection. It may involve antibiotics, antiviral medication, or antifungal medication.

Pneumonia often clears up in a few weeks. See a doctor right away if your symptoms get worse, as you may need to be hospitalized to prevent or treat more serious complications.