A lung infection happens when a virus, bacteria, or fungus gets into your lungs and causes inflammation. Lung infections can range from mild to severe and may require medical treatment.
A lung infection is exactly what it sounds like: an infection of one or both of your lungs. There are a couple of common types of lung infections.
You can get pneumonia by breathing in pneumonia-causing bacteria or a virus from someone with pneumonia. This may occur if the person with pneumonia sneezes or coughs.
Read on to learn the most common symptoms of a lung infection and what treatment you can expect if you have one.
A lung infection can be caused by a virus, bacteria, and sometimes even a fungus.
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 your lungs or the air passages that lead to your lungs. This is called bronchiolitis. Viral bronchiolitis most commonly occurs in infants.
Lung infections such as pneumonia can range from mild to severe. They may be more severe for people with weakened immune systems or chronic conditions, such as chronic obstructive pulmonary disease (COPD).
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.
The 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:
Cough that produces thick mucus
Coughing helps to rid your body of the mucus produced from inflammation of your 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:
- yellowish gray
A cough can linger for several weeks even after other symptoms have improved.
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 sharp pains can be felt in your mid to upper back.
A fever occurs as your body tries to fight off the infection. Your 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 or healthcare professional if your fever goes above 102°F (38.9°C) or if it lasts more than 3 days.
Your muscles and back may ache when you have a lung infection. This is called myalgia. Sometimes you can develop inflammation in your muscles. This can also lead to body and muscle aches when you have an infection.
A runny nose and other flu-like symptoms, such as sneezing, often accompany a lung infection such as bronchitis.
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.
You’ll usually feel sluggish and tired as your body fights off an infection. Rest is crucial during this time.
When you exhale, you might hear a high-pitched whistling sound known as wheezing. This results from narrowed airways or inflammation.
Bluish appearance of your skin or lips
Your lips or nails may start to appear slightly blue in color due to a lack of oxygen.
Crackling or rattling sounds in your 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.
Viruses or bacteria tend to cause lung infections.
Common types of lung infections may include:
More rarely, a fungal infection may also cause lung infections. These fungi may include:
Certain fungal lung infections occur more commonly in people who are immunosuppressed, either from certain types of cancer or HIV or from taking immunosuppressive medications. This can include pneumocystis pneumonia.
But other endemic fungal infections such as pulmonary coccidioidomycosis (valley fever) can affect anyone. They’re contracted by breathing in spores that are commonly found in the soil in the deserts of the Southwestern United States and in Central and South America.
Pneumonia is a common lung infection. It affects the air sacs of your lungs. This infection can impact anyone at any age, and it can be caused by viruses, bacteria, or fungi.
Common causes of pneumonia
- bacteria such as Streptococcus pneumonia (most common), Haemophilus influenzae, and Mycoplasma pneumoniae
- viruses such as the influenza virus or respiratory syncytial virus (RSV) or severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), the virus that causes coronavirus disease 19 (COVID-19)
Doctors also use three different terms to classify pneumonia. They help doctors consider whether people are at risk of drug-resistant pathogens. They include:
- Community-acquired pneumonia: If someone developed pneumonia from work or a social event, they probably have community-acquired pneumonia.
- Healthcare-associated pneumonia: This type occurs when someone develops pneumonia during or after a recent hospital stay.
- Ventilator-associated pneumonia: When someone develops pneumonia after being on a ventilator, this is classified as ventilator-associated pneumonia.
Vaccines may help protect you from certain types of pneumonia.
If you have pneumonia, a doctor can help determine a treatment plan. Multiple treatment options can help resolve pneumonia, depending on the cause.
Bronchitis occurs when your bronchial tubes become inflamed. These tubes deliver air into your lungs.
Bronchitis is usually caused by viral illnesses rather than bacterial infections. But bacterial infections can also cause bronchitis.
Causes of bronchitis can include:
- the influenza virus
- bacteria such as:
- Mycoplasma pneumoniae
- Chlamydia pneumoniae
- Bordetella pertussis
Bronchiolitis occurs when the smallest air passages in your lungs called bronchioles become inflamed. This can cause coughing and difficulty breathing.
RSV is the most common cause of bronchiolitis. But it can be caused by other viruses. It’s more common in children.
A doctor or healthcare professional will ask you about your medical history and symptoms. They may ask questions about your job, recent travel, or exposure to animals.
A doctor will measure your temperature and listen to your chest with a stethoscope to check for crackling sounds.
Common ways to diagnose a lung infection can include:
A bacterial infection usually requires antibiotics to clear it up.
A fungal lung infection may 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 lower 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 (IV) fluids, and respiratory therapy if you’re having difficulty breathing.
Lung infections can be serious if not treated. In general, you may want to see a doctor if your cough lasts more than 3 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 above 100.4°F (38°C)
- between 3 and 6 months, with a fever above 102°F (38.9°C) and seems unusually irritable, sluggish, or uncomfortable
- between 6 and 24 months, with a fever above 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 restless or irritable, vomits repeatedly, or has a severe headache
- has had a fever for more than 3 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 above 103°F (39.4°C)
- have had a fever for more than 3 days
- have a serious medical illness or a compromised immune system
- have recently been to a developing country
You should also get emergency treatment at the nearest emergency room or call 911 or local emergency services if a fever is accompanied by any of the following symptoms:
- mental confusion
- trouble breathing
- stiff neck
- chest pain
- persistent vomiting
- unusual skin rash
- 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, get 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
- avoid smoking tobacco, or consider quitting smoking if you smoke
- get a flu shot every year to prevent influenza infection
- get vaccinated for COVID-19 (please note some vaccines may still be under emergency use authorization for certain groups)
For those at greater risk, the best way to prevent bacterial pneumonia from the most common strains of bacteria is either the PCV13 pneumococcal conjugate vaccine or PPSV23 pneumococcal polysaccharide vaccine.
- 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 a 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’s getting worse
People older than 65 years of age, children younger than 2 years of age, and people with chronic health conditions or a compromised immune system should get medical treatment right away if they experience any symptoms of a lung infection.