Community-Acquired Pneumonia Explained

Community-acquired pneumonia (CAP) is a lung infection you catch outside of a hospital — from people around you, the air you breathe, or surfaces you touch. It happens when bacteria, viruses, or sometimes fungi get into your lungs and cause inflammation. Your lungs fill with fluid or pus, which makes it harder for oxygen to reach your bloodstream. This is different from hospital-acquired pneumonia, which develops after you've been admitted to a hospital for another reason.

CAP is common. Most people who get it are otherwise healthy, though it can be serious depending on your age, overall health, and which germ caused it. Some people recover at home with rest and medication. Others need hospital care. The key is recognizing the symptoms early and getting evaluated by a doctor.

Key Takeaways

  • Community-acquired pneumonia is a lung infection caught outside hospitals, caused by bacteria, viruses, or fungi that inflame your lungs and fill them with fluid.
  • Common symptoms include a cough that lasts more than a week, fever, shortness of breath, and chest pain that worsens when you breathe or cough.
  • Doctors diagnose CAP using a chest X-ray, blood tests, and sometimes a sputum culture to identify which germ is causing the infection.
  • Treatment depends on the cause — antibiotics for bacterial pneumonia, supportive care for viral pneumonia, and hospitalization if oxygen levels drop or you have other serious symptoms.
  • Risk factors include smoking, chronic lung disease, a weakened immune system, and being over 65 years old.

Symptoms That Suggest You Have Community-Acquired Pneumonia

The most common sign is a cough that lasts longer than you'd expect from a cold — usually more than a week. The cough may start dry and then produce mucus that can be clear, yellow, green, or even tinged with blood. You may also have a fever, sometimes quite high, along with chills and sweating.

Other symptoms include shortness of breath (even when you're resting), chest pain that gets worse when you breathe deeply or cough, fatigue that feels more severe than a typical cold, and sometimes nausea or diarrhea. Older adults may have fewer obvious symptoms — sometimes just confusion, a fall, or a sudden loss of appetite signals pneumonia rather than a dramatic fever or cough.

If you have these symptoms and they don't improve after a few days, or if they get worse, contact your doctor. Seek immediate care if you have severe shortness of breath, chest pain, confusion, or lips or fingernails that look blue or gray.

How Doctors Diagnose Community-Acquired Pneumonia

Your doctor will start by listening to your lungs with a stethoscope. Pneumonia often produces crackling sounds or abnormal breathing patterns that a stethoscope can pick up. They'll also ask about your symptoms, how long you've had them, and whether you've been around anyone who was sick.

A chest X-ray is the main tool for confirming pneumonia. It shows areas of your lungs where fluid or inflammation has accumulated, usually appearing as white or cloudy patches. Your doctor may also order blood tests to check your white blood cell count (which rises when you have an infection) and to measure oxygen levels in your blood.

If your doctor needs to know which specific germ is causing the infection — to choose the right antibiotic, for example — they may collect a sample of mucus you cough up (called a sputum sample) and send it to a lab for culture. This takes several days, so initial treatment often starts before the results come back.

Bacterial, Viral, and Fungal Causes

The most common bacterial cause of CAP is Streptococcus pneumoniae. Other bacteria include Haemophilus influenzae and Legionella. Bacterial pneumonia typically comes on suddenly with a high fever and a productive cough (one that brings up mucus).

Viruses cause about half of all CAP cases. Common culprits include influenza (flu), respiratory syncytial virus (RSV), and coronaviruses. Viral pneumonia often develops after you've had cold or flu symptoms for a few days. The cough may be dry at first, and fever is usually lower than with bacterial pneumonia.

Fungal pneumonia is less common and usually affects people with weakened immune systems — those with HIV, those taking immunosuppressant medications, or those who have been exposed to certain fungi in soil or bird droppings. Your doctor will ask about your immune status and any unusual exposures to help narrow down the cause.

Who Is at Higher Risk for Severe Community-Acquired Pneumonia

Age matters: people over 65 tend to have more severe cases and take longer to recover. Smoking damages the lining of your lungs and makes infection more likely. Chronic lung diseases like COPD or asthma increase your risk, as does heart disease.

A weakened immune system — from HIV, cancer treatment, or medications that suppress immunity — makes pneumonia more dangerous. Diabetes, kidney disease, and liver disease also raise your risk. Recent surgery or a stay in the hospital can increase your chances of developing pneumonia.

If you fall into any of these categories, tell your doctor right away if you develop symptoms. You may need closer monitoring or hospital care even if your symptoms seem mild.

Treatment Options for Community-Acquired Pneumonia

Treatment depends on what's causing the pneumonia. If bacteria are responsible, your doctor will prescribe antibiotics. Common choices include amoxicillin-clavulanate, azithromycin, or fluoroquinolones like levofloxacin. You'll typically take these for 5 to 7 days, and it's important to finish the full course even if you feel better.

Viral pneumonia doesn't respond to antibiotics, so treatment focuses on supporting your body while it fights the infection. This means rest, fluids, fever-reducing medications like acetaminophen or ibuprofen, and sometimes supplemental oxygen if your blood oxygen levels drop. Antiviral medications may be used for flu-related pneumonia if started early.

Most people with mild to moderate CAP recover at home. You'll need to rest, drink plenty of fluids, and avoid irritants like smoke. Your doctor may recommend cough medicine or inhalers to help you breathe. If your oxygen levels are too low, you have severe shortness of breath, or you have other serious health conditions, you'll need hospital care where you can receive oxygen, IV fluids, and close monitoring.

Recovery and When to Follow Up

Recovery time varies. Some people feel better within a week or two, while others take several weeks to regain their full energy. A lingering cough can persist for weeks even after the infection has cleared — this is normal. Avoid strenuous activity until your doctor says it's safe.

Schedule a follow-up appointment with your doctor about 4 to 6 weeks after your diagnosis, especially if you're over 50 or have other health conditions. Your doctor may order another chest X-ray to confirm that the pneumonia has cleared. If you're not improving as expected, or if new symptoms develop, contact your doctor sooner.

After you recover, talk to your doctor about pneumonia vaccines. The pneumococcal vaccine protects against the most common bacterial cause of CAP and is recommended for adults over 65 and for younger adults with certain risk factors. The flu vaccine also reduces your risk of getting pneumonia from influenza.

Frequently Asked Questions

Can you catch community-acquired pneumonia from someone else?

You can catch the germs that cause pneumonia — like cold or flu viruses — from other people through coughs, sneezes, or close contact. However, not everyone who catches these germs develops pneumonia. Whether you do depends on your immune system, overall health, and which germ you're exposed to.

Is community-acquired pneumonia the same as walking pneumonia?

Walking pneumonia is a milder form of CAP, usually caused by bacteria like Mycoplasma pneumoniae. You feel sick enough to go about your day but not sick enough to stay in bed. Regular CAP can range from mild to severe, so walking pneumonia is just one point on that spectrum.

What's the difference between community-acquired and hospital-acquired pneumonia?

Community-acquired pneumonia develops outside a hospital setting, while hospital-acquired pneumonia (also called nosocomial pneumonia) develops after you've been hospitalized for at least 48 hours. Hospital germs are often more resistant to antibiotics, making hospital-acquired pneumonia harder to treat.

How long does community-acquired pneumonia last?

Most people feel significantly better within 1 to 2 weeks of starting treatment. Full recovery — including return to normal energy levels — can take 3 to 6 weeks or longer, especially for older adults or those with other health conditions. A lingering cough may persist for several weeks after the infection clears.

Can community-acquired pneumonia turn into sepsis?

Yes, though it's uncommon. Sepsis occurs when the infection spreads to your bloodstream and triggers a severe whole-body response. Signs include very high fever, confusion, rapid heartbeat, and difficulty breathing. Seek emergency care immediately if you develop these symptoms while being treated for pneumonia.