A urinary tract infection (UTI) is a bacterial infection that affects your urinary system, including your urethra, bladder, ureters, and kidneys. Although a UTI can affect any part of your urinary system, it most often causes an infection in your bladder. This is known as cystitis.

Although urine doesn’t contain bacteria, sometimes bacteria in your genital area can get into your urinary tract. This can lead to infection and inflammation, which is known as a UTI.

Many factors can increase your risk for getting a UTI, including having sex.

According to a 2013 review, UTIs will likely affect at least 50 to 60 percent of women in their lifetime. Although men have a lower risk for getting a UTI, especially after sex, it can still happen.

In this article, we’ll look at what you can do to lower your risk for getting a UTI from sex, other possible risk factors, and the most effective treatment.

Yes, you can get a UTI from having sex, especially if you’re a woman.

“During sexual intercourse, thrusting can introduce bacteria up the urethra and into the bladder, increasing the risk of a UTI,” explains Dr. Lakeisha Richardson, MD, OB-GYN.

The reason that women are more prone to getting a UTI from sex is due to female anatomy. Women have a shorter urethra than men, which means it’s easier for bacteria to get into the bladder.

Also, the urethra is closer to the anus in women. This makes it easier for bacteria, like E. coli, to get into the urethra.

It’s important to keep in mind that you can also get a UTI from oral sex, not just penetrative sex. With oral sex, bacteria can still get introduced into the urethra, which can lead to an infection.

Although anyone is susceptible to getting a UTI from having sex, Richardson says women with a history of recurrent UTIs or urinary abnormalities have an increased risk for these infections.

Although it might not be possible to come up with a completely foolproof plan to prevent a UTI, you can certainly take steps to reduce your risk for getting a UTI after sex.

Here are some tips:

  • One helpful tip, says Richardson, is to always urinate after sex. “Eliminating any bacteria in the bladder after sex decreases the risk of a UTI,” she explains.
  • Some doctors also recommend urinating before sex to lower the risk of a UTI.
  • Washing your genital area with warm water before sex may reduce the risk of bacteria getting into the urethra, especially for women.
  • Some contraceptives, such as diaphragms or spermicides, may increase your risk for a UTI. If you think either of these may be contributing to your UTI, consider other forms of contraception.

Richardson also says women who have recurrent UTIs may benefit from taking a prescribed antibiotic after sex. This is typically one dose taken immediately after having sexual intercourse.

If you’re prone to getting UTIs, you may want to talk with your doctor about an antibiotic prescription for this purpose.

While anyone can get a UTI, research shows that women are about eight times more likely to get one than men.

“Also, menopausal women with dry or atrophic tissue have a higher risk of getting a UTI,” Richardson explains.

Other factors that can put you at a higher risk for a UTI include:

  • frequent, intense sexual intercourse
  • sex with a new partner
  • a previous UTI
  • multiple pregnancies
  • obesity
  • diabetes
  • a weakened immune system
  • urinary or genital abnormalities

Another factor is family history. According to Harvard Health, having a mother or sister who has frequent UTIs may increase your risk for getting one, too.

The symptoms that accompany a UTI can cause discomfort. If severe enough, this discomfort can put a serious kink in your day-to-day life.

Some of the more common symptoms of a UTI include:

  • an urge to urinate frequently but passing less urine
  • a burning sensation when urinating
  • pain or pressure in the abdomen or pelvic area
  • blood in urine
  • abnormal urine that may smell or appear cloudy
  • rectal pain (in men)

Depending on the location, you may also experience pain in your upper back and abdominal sides. This may be a sign that the infection has spread to your kidneys. Alongside pain, you may also experience:

  • nausea
  • vomiting
  • chills
  • fever

Sex is a common cause of a UTI, but it’s not the only cause.

According to the American College of Obstetricians and Gynecologists (ACOG), there are many factors that can cause a UTI. Besides having sex, some of the most common causes include:

  • problems with completely emptying your bladder when you urinate
  • blockages or obstructions in your urinary tract, like kidney stones or an enlarged prostate
  • the use of urinary catheters
  • frequent use of antibiotics, which can disrupt the balance of bacteria in your urinary tract

If you have symptoms of a UTI, make an appointment to see your doctor as soon as possible. They’ll be able to diagnose and treat your infection with the right kind of medication.

Most UTIs can be successfully treated with antibiotics. According to the ACOG, most antibiotic treatments are very effective and last only a few days.

To help ease symptoms of abdominal pain or discomfort while urinating, your doctor may also prescribe pain medication.

If a UTI is more complicated or has progressed to a more severe infection, your doctor may prescribe additional medications or consider hospitalization.

If you’re prone to recurring UTIs (defined as three or more UTIs a year), your doctor may consider additional treatments, such as:

  • a low-dose antibiotic that’s taken for 6 months
  • a single dose of antibiotics to be taken immediately after sex
  • vaginal estrogen therapy for postmenopausal women

At home, while you’re waiting to see your doctor, try to:

  • drink plenty of water
  • avoid liquids that may irritate your bladder, including:
    • coffee
    • soda
    • citrus juice
    • alcohol
  • apply a heating pad to your back if you have pelvic or abdominal pain

In addition to any treatment plan your doctor may prescribe, consider the following tips to prevent a UTI from coming back:

  • Drink plenty of fluids, at least six to eight glasses of water a day.
  • Frequently empty your bladder and as soon as you feel the urge. This is especially important immediately after sex.
  • For women, after urinating, wipe from front to back to avoid introducing any bacteria into the urethra.
  • Keep your genital area clean by gently washing with warm water every day, as well as before sex.
  • Use contraception that doesn’t include a spermicide.
  • Avoid douching or using vaginal deodorants or scented tampons or pads.
  • Avoid wearing jeans and underwear that are too tight.

Richardson also suggests taking a vaginal probiotic. These probiotic capsules might prevent recurring UTIs by helping to maintain a healthy vaginal flora on a daily basis.

One popular tip you may have heard about is drinking cranberry juice to prevent UTIs. However, studies on the effectiveness of cranberry juice to prevent a UTI aren’t conclusive.

So, for now, don’t rely on cranberry juice as a prevention method.

Sexual intercourse can increase your risk for getting a UTI, but there are simple steps you can take to reduce your chance of getting one. Pee right after sex and keep your genital area clean. Consider possibly using a different form of contraception.

Talk with your doctor if you have any questions or concerns about how to prevent a UTI. Also, be sure to get medical attention if you have a burning sensation when you pee, blood in your urine, or pain in your abdomen or abdominal sides.