How To Treat Urinary Tract Infections with Cephalexin

By Terez Malka, MD
Medically reviewed checkmarkMedically reviewed
December 17, 2021

Cephalexin is a type of antibiotic that is frequently used to treat urinary tract infections (UTIs).

It is one of the top 100 most commonly prescribed medications in the US, and can be very effective for many common bacterial infections.

However, cephalexin might not be right for everyone, and it’s important to know about potential side effects, who should and should not take this medication, and how to safely take it if it is prescribed to you as part of a treatment plan.

What is a Urinary Tract Infection?

Urinary tract infections are a common type of bacterial infection.

The urinary system includes the urethra, bladder, and kidneys.

In the case of a UTI, the urethra or bladder may be infected, causing burning with urination, frequency, and other uncomfortable symptoms.

Left untreated, UTIs can allow bacteria to travel to the kidneys and result in a more serious infection known as pyelonephritis.

Antibiotics online

Our physicians can prescribe antibiotics for various conditions, but only if necessary. Chat with a provider now.

Get Started

UTI Causes

Urinary tract infections occur more frequently in women than men.

Women are 4-8 times more likely to get them because they have shorter urethras and bacteria can more easily reach the bladder.

E. coli is the most common bacteria that causes UTIs, but there are many other types of bacteria that can infect the bladder.

Bacteria commonly live on and within the body.

Infections occur when bacteria gets into places it does not belong. In this case, bacteria from the skin’s surface or the rectum can enter the urethra and multiply in the bladder, causing painful and uncomfortable symptoms.

UTI Symptoms

Urinary tract infections tend to cause a recognizable set of symptoms:

  • Pain or burning sensations when you urinate
  • Frequent urge to urinate
  • Fever
  • Fatigue
  • Shakiness
  • Pressure in your lower abdomen
  • Pain in your back or side below the ribs
  • Urine that is foul-smelling, looks cloudy, or has a reddish tint

While most people with a UTI will notice these common symptoms, some will not have noticeable symptoms or may not be able to communicate them.

Older people, those who have diabetes, and those with conditions that affect the central nervous system may not be able to feel or report symptoms.

Children can also get UTIs and while they may react to the discomfort, they might not be able to express why.

Unexplained fever, nausea, and/or abdominal pain, especially in younger women, should be discussed with a primary care physician.

UTIs can be diagnosed with a simple urine test, and sometimes the symptoms are so clear that doctors can treat them without requiring an office visit.

If your provider does require a urine sample, you will carefully clean the area of the urethra before urinating into a sterile cup.

The urine will be tested for signs of inflammation that occur in an infection.

The results usually come back within a few minutes.

In some cases, your health care provider may also send your urine to the lab for a urine culture.

A culture can show which exact bacteria is causing the infection, which may be helpful in determining which antibiotic is most effective.

What is Cephalexin?

Cephalexin monohydrate (Keflex) is a broad-spectrum antibiotic that may be used to treat urinary tract infections and other types of bacterial illnesses.

It is in the cephalosporin class of antibiotics.

Cephalexin works to address bacterial infection by interrupting bacterial cell wall growth.

This stops bacterial replication and helps get rid of them.

Using Cephalexin to Treat UTIs

Cephalexin is one of several first-line antibiotics prescribed for UTIs.

It can be safe for those with penicillin or amoxicillin allergies.

When To Take

Cephalexin is available in several forms: capsule, tablet, or suspension liquid.

It may be taken with or without food at intervals of 6-12 hours, depending on the dosage.

A typical course of cephalexin lasts for 5-14 days.

Most people start to notice an improvement in UTI symptoms within a day or two.

If you do not start to feel better or begin to feel worse, let your health care provider know right away.

Even if you do feel completely better, do not stop taking your cephalexin before your prescription ends unless your doctor tells you otherwise.

If you do stop too soon, your infection may not completely resolve or may come back, and you may become resistant to antibiotics, leading to more severe and harder to treat infections.


Your doctor will prescribe an effective dosage of cephalexin based on your age, the severity and type of infection, and your other medical conditions..

Typical dosing for urinary tract infections include:

  • Adults: 1-4g daily, split between 2-4 doses
  • Children: 25-50mg per kilogram of body weight daily, split between 2-4 doses

Who Can and Cannot Use Cephalexin

Most antibiotics come with a risk of side effects, and while cephalexin can be safe in both adults and children, certain people should not take it.

For people with certain health conditions or allergies, cephalexin could result in severe adverse events.

It should be avoided or you should consult with your doctor about the risks if you:

  • Are allergic to cephalosporin antibiotics
  • Have liver or kidney disease
  • Have been diagnosed with colitis
  • Have a seizure disorder
  • Are receiving dialysis

Pregnancy and Breastfeeding

Urinary tract infections are more common during pregnancy, especially in weeks 6-24 because of changes to the urinary tract, pelvic organs, and immune system.

Complications from UTIs, like kidney infections, are a serious concern in pregnancy. 

Most pregnant people are screened for UTIs at their routine wellness visits.

And anyone who is pregnant and notices burning or other UTI symptoms in between visits should tell their obstetric provider right away.

If a UTI does occur in pregnancy, it can still be treated with antibiotics.

There are some risks, but your doctor or provider will go over the potential risks of different types of antibiotics to help make a safe and effective choice.

Cephalexin is a category B drug for pregnancy, along with prenatal vitamins and acetaminophen.

If there is a clinical need to use it, it is generally considered safe to do so.

However, your doctor will take into consideration other health factors and your personal medical history.

For those who are lactating, cephalexin can pass through breast milk to your infant in small amounts.

Cephalexin is generally considered safe for use while breastfeeding but it is important to discuss any antibiotics with your provider and/or your child’s pediatrician.

Side Effects of Cephalexin

Like other antibiotics, cephalexin can cause some common side effects.

Common Side Effects

Diarrhea is the most common side effect of cephalexin.

Other common side effects include: 

Serious Side Effects and Allergic Reactions

Cephalexin (Keflex) and others in the same antibiotic class (cefaclor, cefazolin, others) can also cause serious side effects including severe allergic reactions.

If you have trouble breathing, hives or severe rash, or any swelling to your face, throat, or mouth while taking cephalexin, discontinue your medication and call 911 or seek emergency medical care right away.

Cephalexin Drug Interactions

It’s important to keep your medical provider updated on your health history, allergies, and anything you are taking—including supplements, vitamins, herbs, or OTC medicine.

Any of these could interact with other medications, including cephalexin.

Interactions can decrease the effectiveness of the medication, change the way that it absorbs, or increase the risk of side effects.

Cephalexin is known to interact with the following:

  • Warfarin and other blood thinners
  • Metformin
  • Furosemide
  • Probenecid

It may interact with other drugs, supplements, or OTC pills.

Be sure to let your prescriber know what you are taking, even if you only take something sporadically.

Alternatives to Cephalexin

If you can’t take cephalexin or it is not the most effective antibiotic for your bacterial infection, there are plenty of alternatives.

The following antibiotics are also commonly used for treating UTIs:

It may also be possible to treat mild urinary tract infections without antibiotics, though most UTIs do need an antibiotic to resolve.

Evidence shows benefits for consuming vitamin C, cranberry extract, and probiotics.

A supplement called D-Mannose and staying very well-hydrated have also been shown to help prevent UTIs, but it’s not as clear if any of these can treat an infection once it has occurred. 

If you do want to try to treat a UTI without antibiotics, you should still speak to your health care provider.

They will be able to tell you signs to look out for or when to call back if your symptoms have not resolved.

Antibiotics online

Our physicians can prescribe antibiotics for various conditions, but only if necessary. Chat with a provider now.

Get Started

When to See a Doctor

If you have signs of a UTI, you should speak to your doctor.

Even though some urinary tract infections may clear up without treatment, there are serious risks to leaving a bacterial infection untreated.

An untreated UTI can spread to your kidneys or bloodstream leading to a more severe infection that may require IV antibiotics or a hospital stay, and could lead to permanent damage or even death.

UTIs that are caught early can be treated quickly and easily from your home. Most antibiotic treatments for UTIs work within 3-7 days.

How K Health Can Help

Having signs of a UTI but don’t want to go all the way to the doctor’s office?

Did you know that you can get UTI treatment online through K Health?

We have clinicians available 24/7 to get you the care or medication that you need.

Frequently Asked Questions

How long does it take for antibiotics to work on UTIs?
The answer may be different depending on your other health conditions and the severity of your infection, but most UTI symptoms will start to improve after a few days on antibiotics (maybe even sooner). Your full antibiotic course may be anywhere from 3-14 days. It’s important to take your medication exactly as prescribed. Don’t stop early or you may have a recurrence of the infection or develop a drug-resistant bacteria that can be harder to treat in the future.
Can cephalexin also treat kidney infections?
Cephalexin can be used to treat mild pyelonephritis, a kidney infection. More severe kidney infections will require IV antibiotics.
What should I do if I forgot a dose of my antibiotics?
If you miss a dose of your antibiotics, do not double up. Take your missed dose as soon as you remember. If you are closer to when your next dose would be due, skip the missed dose and resume your normal schedule.

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.

Terez Malka, MD

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

Close button

Talk to a doctor and see if antibiotics are right for you.

Start Now