Our Services
Medical Information
Helpful Resources
Published on: 10/26/2026
Keflex (cephalexin) is a first-generation cephalosporin antibiotic commonly prescribed for bacterial infections of the skin, bones, ears, sinuses, respiratory tract, and urinary tract, including cellulitis and strep throat. Both Keflex and penicillin belong to the beta-lactam family and work by breaking down bacterial cell walls, but cephalexin's different chemical structure gives it broader activity against certain bacteria and more resistance to some bacteria-produced enzymes that inactivate penicillin.
The allergy question is where the distinction matters most, because the majority of people with a penicillin allergy can take Keflex safely while a small number cross-react, and there are several other factors to weigh, including dosing, resistance patterns, and side effects. See below for the complete answer and the details your clinician will consider.
Because the right antibiotic depends on which infection you actually have, and symptoms like a sore throat, painful rash, or burning urination can point to very different causes, it helps to clarify what you are dealing with before your appointment. Take a free, instant, online symptom check to better understand your symptoms and your next steps.
Last reviewed for medical accuracy: 10/22/2026
Keflex (generic name: cephalexin) is an antibiotic in the cephalosporin family. Doctors prescribe it to treat a variety of bacterial infections. If you’ve ever wondered “what is Keflex used for,” you’re in the right place. Below, you’ll find clear, easy-to-understand answers based on trusted medical guidelines.
Keflex fights bacteria by interfering with their ability to build cell walls. It works best against certain Gram-positive and some Gram-negative bacteria. Typical infections treated with Keflex include:
Skin and soft tissue infections
Respiratory tract infections
Ear infections
Bone infections
Urinary tract infections (UTIs)
When taken correctly, Keflex can relieve symptoms such as fever, pain, redness, swelling and discharge. Always finish the full course prescribed—even if you feel better before it’s done—to prevent bacteria from becoming resistant.
Keflex belongs to the beta-lactam class of antibiotics. Here’s what happens after you take it:
Though both Keflex and penicillin interrupt bacterial cell-wall formation, they have key differences:
Chemical structure
Spectrum of activity
Resistance patterns
Allergy considerations
Dosing frequency
This means that in some infections—especially skin, urinary and upper respiratory—Keflex may offer broader coverage or a more convenient dosing schedule compared to penicillin.
Doctors consider Keflex for patients who:
Keflex is FDA-approved for all age groups, including infants, but dosing is adjusted by weight in children.
Like all medicines, Keflex can cause side effects. Most are mild and go away once you finish the course:
If you experience unusual bleeding, yellowing of the skin or eyes, or severe diarrhea, contact a healthcare professional right away.
Your doctor may avoid Keflex if you have:
In such cases, alternative antibiotics or further testing may be needed.
Not sure whether your symptoms need antibiotics or a doctor visit? You might consider doing a free, online symptom check, using the doctor approved Ubie Symptom Checker. It’s fast, confidential and can help guide your next steps before you pick up the phone or head to the clinic.
This overview of “what is Keflex used for” and how it differs from penicillin is meant to inform, not replace professional medical advice. If you’re worried that your infection could be serious or life-threatening, please speak to a doctor right away. Only a qualified healthcare provider can determine whether Keflex—or another treatment—is best for you.
Remember: finishing the full course, reporting side effects promptly and following your doctor’s instructions are key to a safe, successful recovery.
(References)
* Gerber MA, Markowitz M. Management of streptococcal pharyngitis reconsidered. Pediatr Infect Dis. 1985 Sep-Oct;4(5):518-26. doi: 10.1097/00006454-198509000-00016. PMID: 3931060.
* Nathanson S, Deschênes G. [Urinary antimicrobial prophylaxis]. Arch Pediatr. 2002 May;9(5):511-8. doi: 10.1016/s0929-693x(01)00835-1. PMID: 12053547.
* Jahanfar S, Ng CJ, Teng CL. Antibiotics for mastitis in breastfeeding women. Cochrane Database Syst Rev. 2013 Feb 28;2013(2):CD005458. doi: 10.1002/14651858.CD005458.pub3. Epub 2013 Feb 28. PMID: 23450563; PMCID: PMC11297410.
* Mogilevski T, Nickless D, Hume S. β-lactam-associated eosinophilic colitis. BMJ Case Rep. 2015 Jun 23;2015. doi: 10.1136/bcr-2014-206964. Epub 2015 Jun 23. PMID: 26106168; PMCID: PMC4480096.
* Ivbule M, Miklaševičs E, Čupāne L, Bērziņa L, Bāliņš A, Valdovska A. MRSA in Pig Population. Pol J Microbiol. 2017 Sep 27;66(3):383-392. doi: 10.5604/01.3001.0010.4876. PMID: 29319526.
* Wang Y, Xu J, Kong L, Li B, Li H, Huang WE, Zheng C. Raman-activated sorting of antibiotic-resistant bacteria in human gut microbiota. Environ Microbiol. 2020 Jul;22(7):2613-2624. doi: 10.1111/1462-2920.14962. Epub 2020 Mar 13. PMID: 32114713; PMCID: PMC7383503.
* Ramsey A. Cephalexin, Cefaclor, and Ampicillin: Points in the Picture of β-Lactam Cross-Reactivity. J Allergy Clin Immunol Pract. 2022 Feb;10(2):556-557. doi: 10.1016/j.jaip.2021.12.004. PMID: 35144774.
* Gu S, Rajendiran G, Forest K, Tran TC, Denny JC, Larson EA, Wilke RA. Drug-Induced Liver Injury with Commonly Used Antibiotics in the All of Us Research Program. Clin Pharmacol Ther. 2023 Aug;114(2):404-412. doi: 10.1002/cpt.2930. Epub 2023 May 24. PMID: 37150941; PMCID: PMC10484299.
* Parker JL, Deme JC, Lichtinger SM, Kuteyi G, Biggin PC, Lea SM, Newstead S. Structural basis for antibiotic transport and inhibition in PepT2. Nat Commun. 2024 Oct 9;15(1):8755. doi: 10.1038/s41467-024-53096-6. Epub 2024 Oct 9. PMID: 39384780; PMCID: PMC11464717.
* Joshi A, Tzelves L, Juliebø-Jones P, Kamal W, Shrestha A, Somani B. Cost of non-antimicrobials for prophylaxis in the management of recurrent UTIs. Scott Med J. 2025 Aug;70(3):46-53. doi: 10.1177/00369330251355285. Epub 2025 Jul 3. PMID: 40605628.
We would love to help them too.
For First Time Users
We provide a database of explanations from real doctors on a range of medical topics. Get started by exploring our library of questions and topics you want to learn more about.
Was this page helpful?
Purpose and positioning of servicesUbie Doctor's Note is a service for informational purposes. The provision of information by physicians, medical professionals, etc. is not a medical treatment. If medical treatment is required, please consult your doctor or medical institution. We strive to provide reliable and accurate information, but we do not guarantee the completeness of the content. If you find any errors in the information, please contact us.