A lung infection can be caused by a virus, bacteria, and sometimes even a fungus.

One of the most common types of lung infections is called pneumonia. Pneumonia, which affects the smaller air sacs of the lungs, is most often caused by contagious bacteria, but can also be caused by a virus. A person becomes infected by breathing in the bacteria or virus after a nearby infected person sneezes or coughs.

When the large bronchial tubes that carry air to and from your lungs become infected, it’s referred to as bronchitis. Bronchitis is more likely to be caused by a virus than by bacteria.

Viruses can also attack the lungs or the air passages that lead to the lungs. This is called bronchiolitis. Viral bronchiolitis most commonly occurs in infants.

Lung infections like pneumonia are usually mild, but they can be serious, especially for people with weakened immune systems or chronic conditions, such as chronic obstructive pulmonary disease (COPD).

Read on to learn the most common symptoms of a lung infection and what treatment you can expect if you have one.

The symptoms of a lung infection vary from mild to severe. This depends on several factors, including your age and overall health, and whether the infection is caused by a virus, bacteria, or fungus. Symptoms may be similar to those of a cold or flu, but they tend to last longer.

If you have a lung infection, here are the most common symptoms to expect:

1. Cough that produces thick mucus

Coughing helps to rid your body of the mucus produced from inflammation of the airways and lungs. This mucus may also contain blood.

With bronchitis or pneumonia, you may have a cough that produces thick mucus that may have a distinct color, including:

  • clear
  • white
  • green
  • yellowish-grey

A cough can linger for several weeks even after other symptoms have improved.

2. Stabbing chest pains

Chest pain caused by a lung infection is often described as sharp or stabbing. The chest pain tends to worsen while coughing or breathing deeply. Sometimes the sharp pains can be felt in your mid to upper back.

3. Fever

A fever occurs as your body tries to fight off the infection. Normal body temperature is typically around 98.6°F (37°C).

If you have a bacterial lung infection, your fever may rise as high as a dangerous 105°F (40.5°C).

Any high fever above 102°F (38.9°C) often results in many other symptoms, such as:

You should see a doctor if your fever goes above 102°F (38.9°C) or if it lasts more than three days.

4. Body aches

Your muscles and back may ache when you have a lung infection. This is called myalgia. Sometimes you can develop inflammation in your muscles which can also lead to body aches when you have an infection.

5. Runny nose

A runny nose and other flu-like symptoms, such as sneezing, often accompany a lung infection like bronchitis.

6. Shortness of breath

Shortness of breath means that you feel like breathing is difficult or that you can’t breathe in completely. You should see a doctor right away if you’re having trouble breathing.

7. Fatigue

You’ll usually feel sluggish and tired as your body fights off an infection. Rest is crucial during this time.

8. Wheezing

When you exhale, you might hear a high-pitched whistling sound known as wheezing. This is the result narrowed airways or inflammation.

9. Bluish appearance of the skin or lips

Your lips or nails may start to appear slightly blue in color due to lack of oxygen.

10. Crackling or rattling sounds in the lungs

One of the telltale signs of a lung infection is a crackling sound in the base of the lungs, also known as bibasilar crackles. A doctor can hear these sounds using a tool called a stethoscope.

Bronchitis, pneumonia, and bronchiolitis are three types of lung infections. They are typically caused by a virus or bacteria.

The most common microorganisms responsible for bronchitis include:

The most common microorganisms responsible for pneumonia include:

  • bacteria such as Streptococcus pneumonia (most common), Haemophilus influenzae, and Mycoplasma pneumoniae
  • viruses such as the influenza virus or RSV

Rarely, lung infections can be caused by fungi such as Pneumocystis jirovecii, Aspergillus, or Histoplasma capsulatum.

A fungal lung infection is more common in people who are immunosuppressed, either from certain types of cancer or HIV or from taking immunosuppressive medications.

A doctor will first take a medical history and ask about your symptoms. You may be asked questions about your occupation, recent travel, or exposure to animals. The doctor will measure your temperature and listen to your chest with a stethoscope to check for crackling sounds.

Other common ways to diagnose a lung infection include:

  • imaging, such as a chest X-ray or CT scan
  • spirometry, a tool that measures how much and how quickly you take in air with each breath
  • pulse oximetry to measure the level of oxygen in your blood
  • taking a sample of mucus or nasal discharge for further testing
  • throat swab
  • complete blood count (CBC)
  • blood culture

A bacterial infection usually requires antibiotics in order to clear it up. A fungal lung infection will require treatment with an antifungal medication, such as ketoconazole or voriconazole.

Antibiotics won’t work on viral infections. Most of the time, you’ll have to wait until your body fights off the infection on its own.

In the meantime, you can help your body fight off the infection and make yourself more comfortable with the following home care remedies:

  • take acetaminophen or ibuprofen to reduce your fever
  • drink lots of water
  • try hot tea with honey or ginger
  • gargle salt water
  • rest as much as possible
  • use a humidifier to create moisture in the air
  • take any prescribed antibiotic until it’s gone

For more severe lung infections, you may need to stay at a hospital during your recovery. During your stay, you may receive antibiotics, intravenous fluids, and respiratory therapy if you’re having difficulty breathing.

Lung infections can be serious if not treated. In general, see a doctor if your cough lasts more than three weeks, or you’re having trouble breathing. You can book an appointment with a doctor in your area using our Healthline FindCare tool.

A fever can mean different things depending on your age. In general, you should follow these guidelines:


See a doctor if your infant is:

  • younger than 3 months, with a temperature exceeding 100.4°F (38°C)
  • between 3 and 6 months, with a fever above 102°F (38.9°C) and seems unusually irritable, lethargic, or uncomfortable
  • between 6 and 24 months, with a fever over 102°F (38.9°C) for more than 24 hours


See a doctor if your child:

  • has a fever above 102.2°F (38.9°C)
  • is listless or irritable, vomits repeatedly, or has a severe headache
  • has had a fever for more than three days
  • has a serious medical illness or a compromised immune system
  • has recently been to a developing country


You should make an appointment to see a doctor if you:

  • have a body temperature over 103°F (39.4°C)
  • have had a fever for more than three days
  • have a serious medical illness or a compromised immune system
  • have recently been to a developing country

You should also seek emergency treatment at the nearest emergency room or call 911 if a fever is accompanied by any of the following symptoms:

  • mental confusion
  • trouble breathing
  • stiff neck
  • chest pain
  • seizures
  • persistent vomiting
  • unusual skin rash
  • hallucinations
  • inconsolable crying in children

If you have a weakened immune system and develop a fever, shortness of breath, or a cough that brings up blood, seek emergency medical care right away.

Not all lung infections can be prevented, but you can minimize your risk with the following tips:

  • wash your hands regularly
  • avoid touching your face or mouth
  • avoid sharing utensils, food, or drinks with other people
  • avoid being in crowded places where a virus can be easily spread
  • don’t smoke tobacco
  • get a flu shot every year to prevent influenza infection

For those at greater risk, the best way to prevent bacterial pneumonia from the most common strains of bacteria is with one of two vaccines:

  • PCV13 pneumococcal conjugate vaccine
  • PPSV23 pneumococcal polysaccharide vaccine

These vaccines are recommended for:

  • infants
  • older adults
  • people who smoke
  • those with chronic health conditions

A lung infection causes symptoms similar to the cold or flu, but may be more severe and typically last longer.

Your immune system will typically be able to clear a viral lung infection over time. Antibiotics are used to treat bacterial lung infections.

See your doctor right away if you have:

  • difficulty breathing
  • a bluish color in your lips or fingertips
  • severe chest pain
  • a high fever
  • cough with mucus that is getting worse

People older than 65, children under the age of 2, and people with chronic health conditions or a compromised immune system should seek medical treatment right away if they experience any symptoms of a lung infection.