provider image
Welcome! You’re in GoodRx for healthcare professionals. Now, you’ll enjoy a streamlined experience created specifically for healthcare professionals.
Skip to main content

Can You Get a Urinary Tract Infection (UTI) From Having Sex?

Kerry R. McGee, MD, FAAPFarzon A. Nahvi, MD
Updated on May 24, 2024

Key takeaways:

  • Having sex can increase your risk of getting a urinary tract infection (UTI). This is because during sex, the bacteria on your skin and around your anus can be easily introduced into the urinary tract. 

  • Even though a UTI can happen from sex, it’s not a sexually transmitted infection (STI). You can’t transmit a UTI to your partner during sex. 

  • Urinating right after sex helps flush out bacteria that may have entered the urinary tract during sex. This can help minimize the chance that you will develop a UTI.

Loving young couple sitting up cuddling in bed in the morning.
blackCAT/E+ via Getty Images

For many people, the chances of having a urinary tract infection (UTI) increase with sex. But a UTI isn’t a sexually transmitted infection (STI). The types of bacteria that cause UTIs are commonly found on everyone’s skin. 

Sex increases the risk that bacteria from nearby areas will get inside your urinary tract and cause an infection. For some people, this tends to happen over and over again. Fortunately, good treatments are available. There are also a number of things you can do to prevent UTIs when having sex. 

What is a UTI?

UTIs are infections of the urinary tract. The urinary tract is the system that creates, collects, and gets rid of urine from the body. A UTI occurs when bacteria enter the urinary system and find a place to grow.

Anatomy illustration of female (left) and male (right) kidneys, ureters, bladder, and urethra

The urinary tract begins with the kidneys, which create urine. The ureters (a pair of tubes) carry urine from the kidneys down into the bladder. Urine is held in the bladder until you’re ready to empty it. When you go to the bathroom, urine comes out through your urethra — the tube that connects your bladder to the outside.

UTIs can happen anywhere along the urinary tract. And this affects both the symptoms you feel and the treatment you need. A UTI includes:

  • Kidney infections (pyelonephritis) 

  • Bladder infections (cystitis)

  • Urethra infections (urethritis) 

Search and compare options

Search is powered by a third party. By clicking a topic in the advertisement above, you agree that you will visit a landing page with search results generated by a third party, and that your personal identifiers and engagement on this page and the landing page may be shared with such third party. GoodRx may receive compensation in relation to your search.

Usually, when people talk about a UTI, they’re talking about a bladder or urethra infection.

UTI symptoms

The most common symptoms of a UTI are:

  • Pain or burning when you urinate

  • An urgent need to empty your bladder

  • A need to urinate frequently

  • Cloudy, pink, or blood-tinged urine

  • Mild discomfort of the lower abdomen (where the bladder sits)

The symptoms of kidney infections (pyelonephritis) are more severe:

  • Fever

  • Vomiting

  • Pain in the back or side

A kidney infection can happen when a bladder infection goes untreated. Bacteria then travel farther up the urinary tract into the kidney.

GoodRx icon

UTIs from having sex

There’s a clear link between UTIs and sex. This is because the friction involved in sexual activity pushes bacteria toward the urethra. Anything that allows or encourages bacteria to enter the urinary tract increases the risk of a UTI. 

Data shows that UTI symptoms most often begin about 2 days after having sex.

To understand why sex causes UTIs, it helps to know that most UTIs are caused by bacteria from the gastrointestinal (GI) tract. Over 80% of UTIs are caused by Escherichia coli (E. coli) bacteria. These germs are normal and common inside the intestines, where they help with digestion without making you sick.

The other bacteria common in the digestive tracts of healthy people that cause UTIs are mostly:

  • Staphylococcus saprophyticus

  • Proteus

  • Pseudomonas

  • Klebsiella

  • Enterobacter species

Often, bacteria from the gastrointestinal tract are also found on the skin around the anus. In people with typically female genitals, the rectum is in the back, the urethra is in the front, and the vagina is in the middle. Having sex can force bacteria from the rectal area forward, toward the vagina and the urethra. Anything that pushes germs toward the opening of the urethra increases the chances of infection.

Some types of contraceptives contribute to sex-related UTIs as well. Spermicides, including the spermicides on some condoms, change the interaction between bacteria and skin cells by making it easier for bacteria to attach to the inside of the urethra. 

Contraceptive diaphragms are also associated with UTIs. In addition to containing a spermicide, a diaphragm can press on the urethra and cause urine to become trapped. This interferes with how urine flow can help wash bacteria out of the urethra.

Sexual activity itself can make it easier for some species of bacteria to grow. When skin in the genital area becomes chafed, bacteria are able to live there more easily. Those that normally live in the genital area can grow in larger numbers. These shifting populations of bacteria contribute to the connection between sex and UTIs.

Other ways to get a UTI

Of course, you don’t have to be sexually active to get a UTI. Other causes of UTIs include:

  • A foley catheter

  • Recent surgery

  • Abnormal anatomy of the urinary tract

  • Conditions that affect the immune system — like diabetes, autoimmune disease, or cancer

  • Another infection, like HIV

  • Pregnancy

  • Menopause

Who gets UTIs?

Technically, anyone with a urinary tract can get a UTI. But they happen more frequently in women and people with typically female genitals. This is because of their anatomy.

In people with a vulva and vagina, the opening of the urethra is very close to the rectum. Since the bacteria that cause UTIs can come from the rectum, this short distance makes it easy for gut bacteria to find the urinary tract. Also, because the urethra is short, bacteria don’t have to travel very far to get from the skin to the bladder.

In people with a penis, the urethra is much longer, running from the bladder all the way to the tip of the penis. Bacteria from the skin have a long way to travel before reaching the bladder. Plus, the opening to the urethra in a penis is much farther away from the rectum.

The bottom line is that people who have a penis are much less likely to get UTIs. One exception is people who have insertive anal sex. UTIs are more common among people in this group because bacteria from the bowel can enter the tip of the urethra during sex.

Can a man get a UTI from a woman?

If a woman has a UTI, it can’t be passed to a man — even during sex. This is because a UTI is an infection within the urinary tract, which is different from the vagina. The penis doesn’t enter the urinary tract during sex.

UTIs occur when your urinary tract gets infected with your own bacteria. They’re not passed from person to person. Having sex with someone who has a UTI doesn’t mean you’ll get it. 

UTI vs. STI

Even though sex can get a UTI started, a UTI isn’t a sexually transmitted infection (STI). The bacteria that cause UTIs aren’t passed from person to person during sex. These bacteria live normally in your body all the time.

It’s important to understand that UTI and STI symptoms can be similar. Some STIs cause pain or burning with urination because of inflammation in the genital area. Pelvic pain — or pain in the lower part of the abdomen — can also happen with both UTIs and STIs. To complicate things even more, an abnormal urine dipstick result can sometimes point to a UTI when it’s actually caused by an STI.

Where UTIs and STIs differ are symptoms of genital irritation and discharge. If you’ve noticed a white, yellow, chunky, or mixed discharge in your underwear, it’s not likely a UTI. It can be an STI or even another category of vaginal infections, like bacterial vaginosis or a yeast infection.

If you’ve had sex, particularly unprotected sex, and you have symptoms, it’s important to be honest when seeking medical care. Your healthcare professional needs to know if you’re at risk for an STI. A simple urine test can diagnose some STIs. But this test isn’t done automatically when you give a urine sample. Since UTIs are more common than STIs, a healthcare professional might not do the extra testing if they don’t know you’re at risk.

And keep in mind that it’s possible to have both a UTI and an STI at the same time. If you get treated for a UTI but you don’t feel better after a couple days on antibiotics, go back for another checkup.

Can you have sex with a UTI?

It’s probably a good idea to avoid sex while you’re being treated for a UTI. Although there isn’t a hard rule, some healthcare professionals recommend avoiding sexual intercourse until you finish your course of antibiotics. 

For one thing, you’re probably not feeling well. There’s also the concern that having intercourse before the infection has gone away can send the bacteria farther up your urinary tract. This could lead to a worsened infection, like pyelonephritis (an infection of the kidneys). Lastly, having sex can irritate the genital area, introducing even more bacteria to the urinary tract, which isn’t great if you already are fighting an infection there.

Once you finish your course of antibiotics and you’re feeling well, it’s perfectly safe to have sex again. 

How to prevent UTIs from sex

UTIs should be treated to keep them from getting worse. This usually requires a prescription for antibiotics. Since going to see a healthcare professional every time you have sex isn't reasonable for most, it’s helpful to think ahead. Here are a few things you can do to prevent a UTI before it starts.

Urinate after sex

The easiest thing you can do to reduce your chance of getting a UTI after sex is to urinate immediately after sex. Since a UTI is caused by bacteria making their way up the urinary tract, urinating after sex helps prevent that from happening by flushing the bacteria back out. Experts disagree on how effective this method actually is at preventing a UTI, but it’s a quick and easy thing to try.

Drink more water

Drinking more water has also been shown to decrease your risk of developing a UTI. Staying hydrated is thought to help by diluting the bacteria within the urinary tract, preventing it from establishing an infection. 

Avoid spermicides and diaphragms

If you use spermicides or a diaphragm for birth control, you can consider switching to another form of birth control to help prevent UTIs. Since spermicides and diaphragms are associated with an increased risk of UTIs, switching could help minimize your risk.

Consider preventive antibiotics

Last but not least, your primary care provider could prescribe prophylactic (preventive) antibiotics for UTIs. This is done very rarely and only for women who have frequent UTIs that keep happening after sex. Prophylactic antibiotics are taken as a single dose right after sex and helps prevent a UTI before it starts.

The bottom line

UTIs are very common after sex, especially for folks with vaginas. If you’re prone to getting UTIs, try preventive measures like urinating right after sex or drinking more water. You can also talk to your primary care provider to see if preventive antibiotics may be right for you and your body. 

why trust our exports reliability shield

Why trust our experts?

Kerry R. McGee, MD, FAAP
Kerry McGee, MD, FAAP, has over a decade of experience caring for babies, children, and teenagers as a primary care pediatrician. She has a special interest in adolescent health, particularly in adolescent mental health.
Karla Robinson, MD
Karla Robinson, MD, is a medical editor for GoodRx. She is a licensed, board-certified family physician with almost 20 years of experience in health through varied clinical, administrative, and educational roles.
Farzon A. Nahvi, MD
Dr. Nahvi is an emergency medicine physician and author of “Code Gray: Death, Life, and Uncertainty in the ER.” He works clinically at Concord Hospital in Concord, New Hampshire, and is a clinical assistant professor of emergency medicine at the Geisel School of Medicine at Dartmouth. Prior to this, he worked as an ER physician and clinical assistant professor of emergency medicine at the Mount Sinai Health System, NYU Langone Health, NYC Health + Hospitals/Bellevue, and the Manhattan VA. He is a graduate of Cornell University and NYU School of Medicine.

References

Aggarwal, N., et al. (2024). Recurrent urinary tract infections. StatPearls.

Bent, S., et al. (2002). Does this woman have an acute uncomplicated urinary tract infection? JAMA

View All References (11)

Bergamin, P. A., et al. (2017). Non-surgical management of recurrent urinary tract infections in women. Translational Andrology and Urology.

Familydoctor.org. (2018). Urinary tract infection.

Fihn, S., et al. (1998). Use of spermicide-coated condoms and other risk factors for urinary tract infection caused by Staphylococcus saprophyticus. Archive of Internal Medicine.

Hooton, T. M., et al. (1991). Nonoxynol-9: Differential antibacterial activity and enhancement of bacterial adherence to vaginal epithelial cells. The Journal of Infectious Diseases

Hooton, T., et al. (2018). Effect of increased daily water intake in premenopausal women with recurrent urinary tract infections: A randomized clinical trial. JAMA Internal Medicine.

Lee, D. S., et al. (2018). Community-acquired urinary tract infection by Escherichia coli in the era of antibiotic resistance. BioMed Research International.

MedlinePlus. (2022). Urinary tract infection – adults

Moore, E. E., et al. (2008). Sexual intercourse and risk of symptomatic urinary tract infection in post-menopausal women. Journal of General Internal Medicine

Nickel, J. C. (2005). Practical management of recurrent urinary tract infections in premenopausal women. Reviews in Urology.

Price, T. K., et al. (2020). Temporal dynamics of the adult female lower urinary tract microbiota. American Society for Microbiology Journals.

Tomas, M. E., et al. (2015). Overdiagnosis of urinary tract infection and underdiagnosis of sexually transmitted infection in adult women presenting to an emergency department. Journal of Clinical Microbiology.

GoodRx Health has strict sourcing policies and relies on primary sources such as medical organizations, governmental agencies, academic institutions, and peer-reviewed scientific journals. Learn more about how we ensure our content is accurate, thorough, and unbiased by reading our editorial guidelines.

Was this page helpful?

Learn more about Urinary Tract Infections

Stay informed, and get prescription saving tips and more from GoodRx Health.

By providing your email, you consent to receive marketing communications from GoodRx, which may include content and/or data related to men’s health, women's health, reproductive care, or sexual health. You agree to the GoodRx Terms of Use and acknowledge the Privacy Policy. You can unsubscribe at any time.