Woman using laptop to learn what cephalexin is used for

What Is Cephalexin Used For?

Updated January 2, 2024. Written on June 28, 2023 by Theresa Vuskovich, DMD. To give you technically accurate, evidence-based information, content published on the Everlywell blog is reviewed by credentialed professionals with expertise in medical and bioscience fields.

Table of contents

If you’ve been prescribed antibiotics recently and discussed various treatment options with your provider, you may have heard of cephalexin. What is cephalexin used for? Is it the right choice for you?

Cephalexin is a cephalosporin antibiotic used to treat a variety of bacterial infections throughout the body. [1] While it has a few similarities to penicillin, it also has some specific use cases that aren’t always best treated with penicillin. [2]

What is the antibiotic cephalexin used for? In this health guide, we’ll dive into cephalexin drug information and some common applications. We’ll also offer tips for optimizing your antibiotic treatment, whether you’re prescribed cephalexin or something else.

What Is Cephalexin?

Cephalexin is a member of the cephalosporin antibiotic family. [1] Other cephalosporin antibiotics include [3]:

  • Cefazolin
  • Cefuroxime
  • Ceftriaxone

All cephalosporin antibiotics have a molecular structure with a beta-lactam ring; when antibiotic cells interact with bacterial cells, this beta-lactam ring prevents the bacterial cell walls from developing. This eventually causes bacterial cells to die—and this is the primary goal of antibiotic treatment. Cephalexin and penicillin are similar in this way: both have beta-lactam rings and prevent bacterial cell wall formation. [1,2]

Also, like penicillin, cephalexin is effective against both gram-positive and gram-negative bacteria. [1,2] Gram-positive and -negative cells have a few differences, namely their distinct types of cell walls. While some antibiotic medications are only designed to attack one of these two bacteria types, many (like cephalexin and penicillin) can kill both. [4]

The most well-known brand-name cephalexin formula is Keflex®, and it’s available in numerous forms,: such as a pill, oral capsule, or liquid. [1]

It is important to note that cephalexin is not used for the treatment of viral infections such as flu—antibiotics can only affect bacterial cells, not viral cells. [1]

Cephalexin Treatment: 5 Illnesses Commonly Treated with Keflex

Now that we’ve briefly described cephalexin, let’s break down some of its most common uses. This isn’t an exhaustive list—Keflex is a drug with many possible applications. [1]

Urinary Tract Infection (UTI)

Urinary tract infections (UTIs) are among the most common infections; 40% of women experience at least one during their lifetime, and about 10% get a UTI yearly. [5] Bacteria is the primary cause of UTIs.

UTIs can occur anywhere in the urinary system—the urethra, the bladder, and even the kidneys, for example. [5] Despite this, UTIs in any area of the body share a few potential symptoms:

  • Painful or difficult urination (sometimes called dysuria)
  • Frequent urination
  • Blood in the urine (in severe infections)
  • Stomach pain or cramping

Many UTIs are caused by E. coli bacteria, which cephalexin targets with relative ease. But cephalexin isn’t a first-line prescription drug for UTIs—instead, providers primarily prescribe medication like nitrofurantoin, sulfamethoxazole/trimethoprim, and fosfomycin. [6] This is, in part, to avoid antibiotic resistance to cephalosporins (we’ll discuss antibiotic resistance in more detail in a later section).

Cephalexin is also used as a prophylactic for UTIs—if you have recurring UTIs, your provider may provide cephalexin to help you knock out an infection for good. [6]

Skin Infections

Providers also use cephalexin to treat a variety of skin infections, including (but not limited to) [1]:

  • Acne
  • Impetigo
  • Cellulitis

Treating bacterial skin infections like impetigo (caused by Streptococcus and Staphylococcus aureus bacteria) and cellulitis (typically caused by Streptococcus pyogenes bacteria, commonly associated with strep throat) makes sense. [6,7] And, while we often don’t think of acne as bacterial, providers sometimes prescribe antibiotics in small doses to supplement oral and topical medications. [8]

While some antibiotics can make you more susceptible to sunburn, this isn’t the case for cephalexin—yet another reason why it’s commonly prescribed for skin infections. [1]

Bone Infections

Bone infections (called osteomyelitis) occur when bacteria penetrate the bone. This is an uncommon but very serious condition that can cause inflammation or even necrosis. [9] Risks for osteomyelitis include:

  • Past bacterial infections
  • Slowly healing, deep wounds
  • Recent bone breaks
  • Dental infections
  • Recent surgeries

Providers use cephalexin to target two specific bacteria that can cause bone infections: S aureus (gram-positive) and P mirabilis (gram-negative). [1] They may also prescribe it for use before and after a surgical procedure to prevent potential infections.

Lower Respiratory Tract Infection

Providers also use cephalexin to treat bacterial lower respiratory tract infections, including [1,10]:

  • Bacterial pneumonia
  • Bronchitis
  • Bronchiolitis

A viral infection, bacteria, and fungi can all cause pneumonia, and it can take time for providers to determine which kind of pneumonia patients have. So, providers sometimes administer drugs like cephalexin in suspected cases of bacterial pneumonia while they await test results—this is especially common in patients with heart disease or diabetes. [11,12]

Other Streptococcus Infections

Streptococcus pneumoniae bacteria, or S. Pneumoniae, can cause infections throughout the body, including [13]:

  • Pneumonia
  • Bacteremia (a blood infection)
  • Sinusitis (a sinus infection)
  • Otitis media (a middle ear infection)
  • Meningitis

Providers may use cephalexin to treat any of the above illnesses since the medication is such an effective combatant against S. pneumoniae bacteria.

Tips for Antibiotic Treatments

So, you’ve been prescribed cephalexin (or another antibiotic)—what now? Let’s review common medical advice that can help you optimize your course of antibiotics, protect your long-term health, and prevent antibiotic resistance.

Take All Doses As Prescribed

Anytime you take a course of antibiotics, you must take every dose as prescribed even if you start to feel better before your last dose (unless, of course, you experience an allergic reaction or severe side effects—in these cases, seek medical attention right away).

Why is it so important to take every dose of your antibiotic prescription? [14]

  • You could get sick again with a missed dose – The goal of any antibiotic treatment course is to eradicate all of the bacteria that are making you sick. While you might start to feel better after just a portion of these bacteria are out of your system, this doesn’t necessarily mean that every cell is gone. Any leftover bacterium can reproduce—and reinfect you.
  • You could remain infectious – Even if you start feeling better, you could still be infectious if you don’t completely eradicate the infectious bacteria. If you interact with anyone while you have an active infection, you could spread your illness to others.
  • You could develop a resistance to cephalexin – If your infectious bacteria have the chance to regenerate, it might become resistant to the antibiotic you used to treat it in the first place. Antibiotic resistance is a considerable problem in public health today; you can do your part to prevent it by taking your entire course of antibiotics.

Protect Your Healthy Bacteria Biome

Unfortunately, antibiotics can target some of the healthy bacteria living in our bodies. [15] While taking antibiotics, you can support your body’s biome by eating probiotic foods: items containing live cultures. [16]

But before heading to the grocery store to pick up kombucha, kimchi, and cheese, read labels closely: not all fermented foods contain probiotics that will survive transit through your digestive tract. If you’re looking to boost your bacteria biome during a course of antibiotics, yogurt with live cultures is typically a safe bet. [16]

Prevent the Spread of Disease

During your course of antibiotics, you may be infectious until you’ve taken your final dose. So, to keep your illness from spreading in your family or community, consider [17]:

  • Quarantining – Distance as much as you can to prevent spreading your illness.
  • Boosting hygiene – Wash your hands more often and encourage people around you to do the same.
  • Cleaning surfaces – If you share space with others, keep shared surfaces clean with antibacterial products like all-purpose cleaners.

With just a few added precautions, you could help the people around you stay healthy while you recover from your illness.

Virtual Care via Everlywell

If you suspect that you might have a bacterial infection, reaching out to a healthcare provider is the only way to confirm your diagnosis, receive prudent medical advice, and get the antibiotic treatment you need. But making an appointment with an in-person provider can be inconvenient and put others at risk of contracting your illness – so how do you get antibiotics without seeing a healthcare provider in person?

Enter Everlywell. We offer convenient virtual care visits that give you the chance to speak with a healthcare provider wherever you are. Virtual care visits are synchronous telehealth appointments with a licensed provider who can assess your symptoms and help you determine what tests and medications you need, including UTI antibiotics online.

Ready to unlock convenient, high-quality care from Everlywell? Schedule a virtual care visit now.

  1. Herman TF, Hashmi MF. Cephalexin. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  2. Yip DW, Gerriets V. Penicillin. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  3. Bui T, Preuss CT. Cephalosporins. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  4. Silhavy TJ, Kahne D, Walker S. The bacterial cell envelope. Cold Spring Harbor Perspectives in Biology. 2010;2(5). doi:10.1101/cshperspect.a000414
  5. Bono MJ, Leslie SW, Reygaert WC. Uncomplicated urinary tract infections. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  6. Impetigo: All you need to know. Centers for Disease Control and Prevention. June 27, 2022. Medical Citation URL. Accessed March 21, 2024.
  7. Brown BD, Watson KL. Cellulitis. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  8. Tan AU, Schlosser BJ, Paller AS. A review of diagnosis and treatment of acne in adult female patients. International Journal of Women’s Dermatology. 2018;4(2):56-71. doi:10.1016/j.ijwd.2017.10.006
  9. Momodu II. Osteomyelitis. StatPearls. Medical Citation URL. Accessed March 21, 2024.
  10. Noviello S, Huang D. The basics and the advancements in diagnosis of bacterial lower respiratory tract infections. Diagnostics. 2019;9(2):37. doi:10.3390/diagnostics9020037
  11. Metlay JP, Waterer GW, Long AC, et al. Diagnosis and treatment of adults with community-acquired pneumonia. an official clinical practice guideline of the American Thoracic Society and Infectious Diseases Society of America. American Journal of Respiratory and Critical Care Medicine. 2019;200(7). doi:10.1164/rccm.201908-1581st
  12. Sethi S. Community-acquired pneumonia - pulmonary disorders. Merck Manuals Professional Edition. Medical Citation URL. Accessed March 21, 2024.
  13. Types of pneumococcal disease. Centers for Disease Control and Prevention. Medical Citation URL. Accessed March 21, 2024.
  14. Combating antibiotic resistance. U.S. Food and Drug Administration. Medical Citation URL. Accessed March 15, 2024.
  15. Patangia DV, Anthony Ryan C, Dempsey E, Paul Ross R, Stanton C. Impact of antibiotics on the human microbiome and consequences for host health. MicrobiologyOpen. 2022;11(1). doi:10.1002/mbo3.1260
  16. Probiotics. NIH Office of Dietary Supplements. Medical Citation URL. Accessed March 21, 2024.
  17. How to prevent infections. Harvard Health. Medical Citation URL. Accessed March 21, 2024.

Theresa Vuskovich, DMD is a dentist and public health expert with over 10 years of experience. Vuskovich has written, edited, and reviewed health content for the Accreditation Council for Medical Affairs (ACMA), Everly Health, and other organizations, and has a decade of experience practicing dentistry. Dr. Vuskovich is skilled in patient education, medical affairs, sleep medicine, stroke prevention, medications, and other health and wellness topics. Theresa holds a BS, MPH, and DMD, and recently returned to the University of Florida to complete her master of Pharmaceutical Sciences studies (MSPharm).
Everlywell makes lab testing easy and convenient with at-home collection and digital results in days. Learn More