Key takeaways:
Urinary tract infections (UTIs) happen when germs from the skin or gut get into the urinary tract.
These germs don’t cause a problem in the skin or the gut. But when they get into the urinary tract, they can multiply and irritate the lining of the urine tubes and bladder. That’s how you get the symptoms of a UTI.
The most common type of germ that causes a UTI is the bacteria Escherichia coli.
Most often, bacteria get into urine from having sex and wiping back to front after using the toilet.
If you’ve ever had a urinary tract infection (UTI), you’ve probably wondered how and why that happens. A UTI happens when germs get into the urethra (the urination tube) and travel up to the bladder or kidneys where they multiply.
But why does this happen? Germs from the gut and rectum can get into the urethra because the urethra and rectum openings are so close together. When those germs reach the bladder, they can multiply and cause an infection.
The most common cause of a UTI is Escherichia coli — a bacteria in the gut and poop. But when other germs get into the urinary tract, they can also cause UTIs. Most commonly, UTIs are caused by:
Bacteria: Aside from E. coli, other bacteria that are common on the skin or in the intestines can travel into the urinary tract and cause UTIs.
Fungi (yeast): Candida is the most common fungus to cause UTIs. This is the same type of fungus that causes thrush or yeast infections. If you have diabetes, use a catheter, or have other medical conditions that weaken your immune system, you’re at higher risk for a fungal UTI.
Though less common, UTIs can be caused by other germs:
Viruses: A virus can cause a UTI, but this is very rare. Viral UTIs can occur in people with weak immune systems, like from cancer, cancer treatment, or HIV/AIDS.
Parasites: Trichomoniasis is a parasite that can be passed from person to person during sexual activity. It can then travel up the urethra to the bladder and cause an infection. Schistosomiasis is another example of a parasite that can cause UTIs. It’s very rare in the U.S., but it may be a concern if you travel to Africa, South Africa, or Asia.
The most common reasons a UTI happens is from sex and back-to-front wiping after going to the bathroom. And it’s not hard to understand why: Both of these practices can move bacteria from the anus, rectum, or skin into the urethra.
While some people have immune systems that can overcome germs in the urinary tract, others are more prone to getting UTIs. This comes down to a person’s individual risk factors.
Let’s take a closer look at why UTIs happen.
Sex is a common way that bacteria from the skin, anus, or rectum gets into the urethra. This is especially true for women, who tend to get more UTIs than men. And studies show that the more often a person has sex, the more likely they are to have UTIs.
Bacteria from the anus can get into the urethra when people — especially those with female anatomy — wipe from back to front after going to the bathroom. Best practice is to wipe from front to back. Or you can separately wipe the front and then wipe the back.
A catheter is a tube that inserts into the urethra and then the bladder to empty it. If the tube has germs on it, those germs can cause an infection.
UTIs caused by using a urinary catheter are one of the most common infections people get in the hospital. Catheter-related UTIs can affect people who self-catheterize to empty their bladders and those who have a long-term urinary catheter.
No. Antibiotics get rid of bacterial infections, they don’t cause UTIs. But antibiotics can change the balance of healthy microbes in the body (the “microbiome”).
Long-term antibiotic use can also change how future infections respond to antibiotics and the way the body responds to infections. Here’s how:
Antibiotics change your microbiome. This means that they kill both bad and good bacteria in the body. And a drop in healthy bacteria in the body — especially in places like the gut and the vagina — creates an environment where harmful microbes can thrive. For example, taking antibiotics can make it more likely that you’ll get a fungal infection like Candida (a yeast infection). This can feel like a UTI, but it isn’t.
Antibiotics can cause resistance. Taking a lot of antibiotics for a long time can cause bacteria to become resistant. And the usual antibiotics won’t work to treat a UTI caused by resistant bacteria.
This doesn’t mean you should never take antibiotics. But it means that you should only take antibiotics when you need them. Taking antibiotics when you don’t need them can cause unnecessary side effects. And when you do take them, you should finish the entire course, even if you start feeling better before your course is over.
No. Stress can put you at a higher risk for a UTI, but it does not directly cause a UTI. When you’re stressed, your body makes more cortisol — the “fight-or-flight” hormone. But, over time, high cortisol levels actually weaken your immune system.
Since you need your immune system to be healthy to fight off infections, you might be more likely to get an infection if you’re dealing with high levels of stress.
More than half of adult women will get a UTI at least once in their lives. And some get recurrent UTIs. A recurrent UTI is defined as 2 or more infections in 6 months, or 3 or more infections in a 12 months.
Although it’s less likely, men can also get UTIs.
Risk factors for UTIs include:
Dehydration: When you don’t drink enough water, urine becomes more concentrated and can irritate your bladder. This irritation can make you more likely to get an infection.
Kidney or bladder stones, or an enlarged prostate: Anything that blocks the flow of urine can lead to a UTI. Kidney and bladder stones, as well as an enlarged prostate, can cause a block in the urinary tract system. When urine backs up, it creates a breeding ground for any bacteria present.
A weakened immune system: Weak immune systems, such as in HIV or diabetes, can’t fight off germs very well. This means that germs can multiply and are more likely to cause an infection, including UTIs.
Incomplete emptying of the bladder: If you can’t completely empty your bladder, the leftover urine can help bacteria grow and cause an infection. This commonly happens in pregnancy. Weak bladder muscles caused by nerve damage or aging also prevent complete emptying of the bladder.
Use of spermicide, like with condoms and diaphragms: Spermicide kills sperm. But it can also kill healthy bacteria in the vagina, and this lets bad bacteria grow.
Changes in estrogen hormone levels: Lower estrogen levels during and after menopause can affect the healthy vaginal microbiome. This happens because the vagina becomes less acidic as estrogen levels drop. This means that the vagina becomes a more germ-friendly environment, where bad microbes are more likely to thrive and cause infections. The same is true for young girls, before estrogen levels rise in adolescence.
In addition to being careful about how you wipe after going to the bathroom, there are a few other tips for preventing UTIs if you regularly get them:
Don’t hold urine. Go to the bathroom regularly, and keep your bladder empty. This makes your bladder a less friendly environment for bacteria to grow and flourish in.
Pee right after sex. Flushing your urinary tract after sex may help get rid of any germs that enter during sex.
Drink water often. Staying hydrated keeps urine flowing through your urinary tract. This can help flush out your urinary tract and get rid of any germs that may be present.
Avoid spermicides. It’s especially important to avoid birth control methods that involve spermicides if you have recurrent UTIs. Instead, use condoms and diaphragms without spermicide. An IUD can also be a good birth control method, but you need to combine it with a barrier method to also prevent sexually transmitted infections.
Use vaginal estrogen. Estrogen is key to a healthy vaginal microbiome. During and after menopause, estrogen levels drop. Using vaginal estrogen can help keep the vagina acidic and healthy.
Eat cranberries or drink cranberry juice. Cranberries have compounds that make it hard for bacteria to stick to the inside of the urinary tract. There’s mixed evidence that cranberry products might help prevent UTIs in some people with recurrent UTIs. But it won’t treat a UTI.
Talk with your provider about methenamine hippurate. Methenamine hippurate is a prescription medication that makes it harder for bacteria to grow in the urethra and bladder. If you’re experiencing frequent UTIs, it could be a good option and help you avoid frequent use of antibiotics.
UTIs happen when germs, like bacteria from the skin or gut, get into the urethra and bladder. The rectum and urethral openings are close together in female anatomy, which makes UTIs more likely. Sex as well as the hormonal changes of pregnancy and menopause can make this even more likely. And some people have weaker immune systems or anatomical reasons that can put them at higher risk for UTIs. To prevent UTIs, pee right after sex and regularly, wipe front to back after the bathroom, and stay hydrated.
Arnold, J. J., et al. (2016). Common questions about recurrent urinary tract infections in women. American Family Physician.
Centers for Disease Control and Prevention. (n.d.). How antibiotic resistance happens.
Centers for Disease Control and Prevention. (2015). Catheter-associated urinary tract infections (CAUTI).
Elster, A. B., et al. (1981). Relationship between frequency of sexual intercourse and urinary tract infections in young women. Southern Medical Journal.
Imam, T. H. (2022). Overview of urinary tract infections (UTIs). Merck Manual.
Medina, M., et al. (2019). An introduction to the epidemiology and burden of urinary tract infections. Therapeutic Advances in Urology.
Sule, N., et al. (2018). A new link between stress and infection. The FASEB Journal.
Tan, C. W. et al. (2016). Urinary tract infections in adults. Singapore Medical Journal.