Cephalexin: How Long Does It Stay in Your System?

By Terez Malka, MD
Medically reviewed checkmarkMedically reviewed
November 27, 2021

Given concerns about antibiotic resistance, when a doctor prescribes cephalexin or any other antibiotic, it’s natural to have some questions.

The first one you should ask: Is this necessary?

You only want to take antibiotics if you need them and have a bacterial infection. (Antibiotics don’t treat viral infections.)

If the answer is yes, you may wonder how long cephalexin stays in your system, as well as what side effects to watch out for.

Discuss all of this with the healthcare provider writing the prescription, and read on for detailed information about what cephalexin treats, how it works, how long it stays in your system, and its side effects and interactions.

This way you will be fully informed before starting the medication.

Have questions about antibiotics? Chat with a doctor today for just $35
Chat Now

Cephalexin Uses

Cephalexin (Keflex) is a common antibiotic drug used to treat many conditions, including:

It’s also used to prevent endocarditis, an infection that causes inflammation of the lining of the heart.

How Cephalexin Works

Cephalexin works by preventing the growth of the bacterial cell wall.

When this happens, the bacteria causing the infection can’t multiply.

How Long Cephalexin Stays in Your System

Most people eliminate more than 90% of cephalexin through their urine within eight hours of taking the medication.

However, several factors can influence how someone’s body processes the medication, including kidney function, age, and more. 

Factors to Consider

Age, health, body mass, dosage, and metabolism are some of the most important factors that may impact how your body processes cephalexin. 


Cephalexin is safe and effective for adults aged 65 and older.

However,  because the medication is excreted by the kidneys, the risk of toxic reactions may be greater for people who have impaired renal function.

Older adults are more likely to have renal dysfunction, so if you’re over 65, it’s important to talk to your doctor about the right dose for you.


Impaired kidney function affects how your body processes and excretes cephalexin.

Other conditions that may put you at a higher risk for side effects when taking the medication include seizure disorders, liver disease, colitis, and allergies to other antibiotics. 

Body mass

Lower or higher body masses, as well as body composition (how much lean mass versus fat someone has), may affect how long cephalexin stays in the system. 


The dose your provider recommends may affect how long cephalexin stays in your system.

Dosage varies based on the specific infection and your age, and can also be customized to accommodate chronic conditions.

For example, if you have impaired kidney function, your doctor may prescribe a lower dose.


Some people metabolize medications faster or slower than others do.

Before starting the prescription, you can ask your provider whether or not your metabolism may affect how your body processes and excretes cephalexin. 

Cephalexin Side Effects

Like most antibiotics, cephalexin may cause unwanted side effects, including:

  • Diarrhea
  • Abdominal pain
  • Indigestion
  • Vomiting
  • Nausea
  • Headache
  • Fatigue
  • Vaginal discharge or itchiness (due to a yeast infection) 
  • Increased levels of creatinine in the body
  • Dizziness
  • Agitation
  • Confusion
  • Joint pain

In rare cases, cephalexin may cause a severe allergic reaction known as anaphylaxis, which can cause hives, difficulty breathing, and swelling of the face, lips, tongue, or throat.

Seek medical attention immediately if you are experiencing an allergic reaction or other severe side effects when taking cephalexin.

Cephalexin Interactions and Warnings

Cephalexin may cause adverse reactions when taken with other medications.

Additionally, certain conditions may put you at a higher risk for side effects when taking cephalexin. 

What to avoid while taking cephalexin

Certain medications can increase the risk of side effects when taking cephalexin.

If you take any of the following, ask your provider if cephalexin is safe to use:

  • Metformin
  • Furosemide
  • Warfarin or other blood thinners
  • Probenecid
  • Sulfinpyrazone

Cephalexin risks

Cephalexin isn’t right for everyone.

Let your provider know if you have any of the following conditions before starting cephalexin:

  • Colitis
  • Kidney disease
  • Liver disease
  • Seizure disorder
  • Allergies to medications or cephalosporin antibiotics

Additionally, pregnant or nursing people, seniors, and people who are allergic to beta-lactam medications should consult with their provider to determine if cephalexin is right for them.

Have questions about antibiotics? Chat with a doctor today for just $35
Chat Now

When to See a Doctor

Severe side effects are rare, but possible, when taking cephalexin.

If you experience any of the following side effects, contact your doctor as soon as possible:

  • Watery or bloody stools
  • Pink, red, or dark brown urine
  • Painful stomach cramps
  • Fever that does not go away 
  • Rash
  • Hives
  • Swelling of the face, throat, tongue, lips, or eyes
  • Difficulty breathing or swallowing
  • Wheezing
  • Hallucinations
  • Any sign that your original infection has returned

How K Health Can Help

Did you know you can get affordable primary care with the K Health app?

Download K to check your symptoms, explore conditions and treatments, and if needed text with a doctor in minutes. K Health’s AI-powered app is HIPAA compliant and based on 20 years of clinical data.

Frequently Asked Questions

How long does it take for cephalexin to leave the body?
In most cases, more than 90% of cephalexin leaves the body within eight hours of taking the medication. But several factors, including your metabolism and any health conditions, could make this process take longer.
How long does it take for antibiotics to leave your system?
How long it takes for antibiotics to leave your system depends on the antibiotic. Antibiotics like cephalexin will be excreted within about eight hours of taking the medication.
How long do the side effects of cephalexin last?
Most of the common side effects experienced when taking cephalexin—including diarrhea, indigestion, vomiting, or nausea—go away on their own within a few days. If any side effects persist or if you experience severe side effects, contact your doctor immediately.
How can I reduce the side effects of cephalexin?
You can reduce the risks of side effects of cephalexin by taking it as directed by your doctor or pharmacist. Be sure to tell your doctor about any medications you are currently taking as well as health conditions that may cause an adverse reaction when taking the medication.

K Health articles are all written and reviewed by MDs, PhDs, NPs, or PharmDs and are for informational purposes only. This information does not constitute and should not be relied on for professional medical advice. Always talk to your doctor about the risks and benefits of any treatment.

K Health has strict sourcing guidelines and relies on peer-reviewed studies, academic research institutions, and medical associations. We avoid using tertiary references.

Terez Malka, MD

Dr. Terez Malka is a board-certified pediatrician and emergency medicine physician.