How pneumonia treatment works

Treatment for pneumonia depends on what caused it — bacterial, viral, or fungal — and how severe your case is. Bacterial pneumonia is usually treated with antibiotics, which kill the bacteria causing the infection. Viral pneumonia typically does not respond to antibiotics; instead, your body's immune system fights the virus while you rest and stay hydrated. Fungal pneumonia is rare but requires antifungal medication. Your doctor will determine which type you have through a chest X-ray and sometimes a sputum sample (mucus you cough up), then recommend the right treatment path.

Most people with mild to moderate pneumonia can be treated at home. Severe pneumonia — especially in older adults, people with weakened immune systems, or those with other serious health conditions — may require hospitalization. In the hospital, doctors can give oxygen if your blood oxygen level is too low, deliver intravenous (IV) fluids and medications, and monitor your heart rate and breathing closely.

Key Takeaways

  • Bacterial pneumonia is treated with antibiotics prescribed by your doctor, usually taken by mouth for 7 to 14 days.
  • Viral pneumonia does not respond to antibiotics; treatment focuses on rest, fluids, and letting your immune system clear the infection.
  • Your doctor uses a chest X-ray to confirm pneumonia and may test sputum or blood to identify the cause.
  • Most people recover at home, but hospitalization is needed if oxygen levels drop, breathing becomes difficult, or you have serious underlying health conditions.
  • Recovery typically takes 2 to 4 weeks, though fatigue can linger longer in older adults or those with severe cases.

Antibiotics for bacterial pneumonia

If your doctor determines you have bacterial pneumonia, they will prescribe an antibiotic. The most common first choice is amoxicillin or azithromycin (a macrolide antibiotic), though your doctor may choose differently based on your age, other medications, allergies, and local patterns of antibiotic resistance. You take the full course even if you feel better after a few days — stopping early allows bacteria to survive and can lead to relapse or resistance.

Antibiotics typically work within 24 to 48 hours; you should start feeling better — less fever, easier breathing — by day two or three. The full course is usually 7 to 14 days. If you are not improving after three days, or if you get worse, contact your doctor; you may need a different antibiotic or hospitalization. Some people develop side effects like nausea or diarrhea; report these to your doctor, as they may switch you to a different medication.

Managing viral pneumonia at home

Viral pneumonia has no specific medication to kill the virus. Instead, treatment focuses on supporting your body while your immune system clears the infection. This means rest, staying hydrated by drinking water and warm fluids, and using over-the-counter fever reducers like acetaminophen or ibuprofen to manage aches and fever. A humidifier in your bedroom can ease coughing and congestion.

Viral pneumonia usually improves within 7 to 10 days, though a lingering cough can last weeks. If your breathing becomes difficult, your lips or fingernails turn blue, or you develop chest pain, seek medical attention immediately — these are signs your case is worsening and you may need oxygen or hospitalization. Do not use cough suppressants unless your doctor recommends them; coughing helps clear mucus from your lungs.

When hospitalization is necessary

You may need hospital care if your oxygen level falls below 92 percent, you are struggling to breathe, you are coughing up blood, or you have severe chest pain. Hospitalization is also recommended if you are over 65, have a weakened immune system, have heart or kidney disease, or are pregnant. In the hospital, doctors can give supplemental oxygen through a mask or nasal tube, deliver IV antibiotics or fluids, and use machines to monitor your heart rate, blood pressure, and oxygen level continuously.

Some people with very severe pneumonia need a ventilator — a machine that helps them breathe — if their lungs cannot take in enough oxygen on their own. This is typically temporary; as the infection clears and your lungs heal, you gradually need less support. Hospital stays for pneumonia usually last 3 to 7 days, though people with serious underlying conditions may stay longer.

What to expect during recovery

After treatment starts, most people begin to feel better within a few days. Fever usually drops first, followed by easier breathing and less cough. However, full recovery takes time. A lingering cough is common for 2 to 4 weeks after the infection clears, and fatigue can persist even longer — some people feel tired for several weeks. This is normal and does not mean the pneumonia is returning.

During recovery, continue resting, drinking fluids, and eating nutritious food to help your body heal. Avoid smoking and secondhand smoke, which can slow recovery and damage healing lungs. You can return to light activities like short walks once you feel up to it, but avoid strenuous exercise or heavy lifting for at least a week after your symptoms resolve. If you are not improving after two weeks, or if new symptoms develop, contact your doctor.

Preventing complications

The main complication of untreated or severe pneumonia is sepsis — a life-threatening condition where the infection spreads to the bloodstream and damages organs. Other complications include pleural effusion (fluid around the lungs), empyema (pus around the lungs), or acute respiratory distress syndrome (ARDS), where the lungs fill with fluid and cannot deliver enough oxygen. These are rare in people who receive prompt treatment.

To avoid complications, take all prescribed antibiotics as directed, keep follow-up appointments with your doctor, and seek immediate care if you develop severe shortness of breath, confusion, chest pain, or coughing up blood. If your doctor recommends a follow-up chest X-ray after treatment, attend it — this confirms the infection has cleared and rules out other problems like a collapsed lung or tumor that might look like pneumonia on the first X-ray.

Frequently Asked Questions

Can I take over-the-counter cough medicine while treating pneumonia?

Cough suppressants are generally not recommended for pneumonia because coughing helps clear mucus and bacteria from your lungs. Acetaminophen or ibuprofen for fever and aches are fine. If coughing is so severe it prevents sleep, ask your doctor before using any cough medicine; they may recommend something safer for your situation.

How do I know if my pneumonia is getting worse instead of better?

Worsening pneumonia shows as increased shortness of breath, high fever that returns after dropping, confusion, chest pain, or coughing up blood. If any of these develop, seek medical attention right away. Improvement means less fever, easier breathing, and less cough within the first few days of treatment.

Is it safe to exercise while recovering from pneumonia?

Rest is important in the first week or two. Light activity like short walks is fine once you feel up to it, but avoid strenuous exercise, running, or heavy lifting for at least a week after symptoms resolve. Pushing too hard too soon can delay recovery or cause a relapse.

Why does my doctor want a follow-up X-ray after pneumonia treatment?

A follow-up X-ray confirms the infection has cleared and checks that your lungs are healing normally. It also rules out other problems — like a collapsed lung, fluid buildup, or a mass — that might have been hidden by the pneumonia on the first X-ray. This is especially important if you smoke or are over 50.

Can pneumonia come back after treatment?

Recurrent pneumonia is uncommon if you complete the full course of antibiotics and rest properly. However, some people — especially smokers, those with chronic lung disease, or older adults — are more prone to repeated infections. If you get pneumonia more than once in a year, your doctor may investigate whether an underlying condition is making you vulnerable.