How Are UTIs Caused? Bacteria, Sex, and Other Risks

Urinary tract infections happen when bacteria from the gut colonize the area around the urethra and travel upward into the bladder. About 75% of uncomplicated UTIs are caused by a specific strain of E. coli that lives harmlessly in the intestines but becomes harmful once it reaches the urinary tract. Understanding exactly how this process works helps explain why some people get UTIs repeatedly while others rarely do.

How Bacteria Enter the Urinary Tract

The infection route is almost always ascending, meaning bacteria move upward from the outside in. Gut bacteria first settle on the skin around the urethra, an area called the periurethral zone. From there, they migrate up the urethra into the bladder. If the infection isn’t cleared at that point, bacteria can continue climbing up the ureters into the kidneys, causing a more serious infection called pyelonephritis.

This upward migration is the reason anatomy matters so much. The female urethra is roughly 4 centimeters long in adults, giving bacteria a much shorter path to the bladder compared to the male urethra. That single difference is the primary reason women develop UTIs far more frequently than men. In young girls, the urethra can be as short as 12 to 14 millimeters, which partly explains why some children experience recurrent infections.

The Role of E. Coli

E. coli causes 75% of uncomplicated bladder infections and about 65% of complicated ones (infections involving structural abnormalities or other medical conditions). These aren’t random E. coli strains. They’re a specialized subtype called uropathogenic E. coli that carry molecular tools allowing them to latch onto the lining of the bladder wall. Once attached, they’re harder for the body to flush out during urination, which is normally one of your best defenses against infection.

Other bacteria can cause UTIs too, including Klebsiella and Proteus species, but E. coli dominates the picture. All of these organisms share the same origin: the intestinal tract. That’s why wiping direction, hygiene habits, and anything that moves gut bacteria closer to the urethra can raise your risk.

Sexual Activity and UTI Risk

Sex is one of the most common triggers for UTIs, particularly in women. The physical motion during any type of sexual activity can push bacteria from the genital and anal area toward the urethral opening. Once bacteria reach that opening, the short distance to the bladder makes infection likely. This isn’t limited to vaginal intercourse. Any activity around the genitals can shift bacteria into the wrong place.

Urinating after sex helps flush bacteria out of the urethra before they can establish themselves in the bladder. It’s a simple, well-supported preventive step. The idea isn’t that sex is inherently dangerous to urinary health, but that the mechanical reality of it creates opportunities for bacteria to migrate.

How Your Microbiome Protects You

Your body isn’t defenseless against these invaders. The vaginal microbiome, when healthy, is dominated by Lactobacillus bacteria that actively prevent UTI-causing organisms from gaining a foothold. These beneficial bacteria work through several mechanisms at once: they produce lactic acid that creates a hostile environment for E. coli, they physically outcompete harmful bacteria for space on tissue surfaces, they block pathogens from attaching to cells, and they stimulate the local immune system.

When this microbial balance gets disrupted, whether by antibiotics, hormonal changes, or certain hygiene products, E. coli and other pathogens can colonize the vaginal and periurethral area more easily. Maintaining healthy vaginal flora is directly associated with lower rates of recurrent UTIs, which is why researchers have explored Lactobacillus-based treatments as a prevention strategy.

Pregnancy Changes the Plumbing

Pregnancy creates a perfect storm for UTIs through several overlapping changes. Progesterone, which rises dramatically during pregnancy, relaxes the smooth muscle of the ureters. This reduces the wave-like contractions that normally keep urine moving downward. At the same time, the growing uterus physically compresses the ureters where they cross the pelvic brim, particularly on the right side.

The result is significant urinary stasis. The capacity of the collecting system in the kidneys increases by an estimated 200 to 300 milliliters, meaning urine sits longer before draining. By the third trimester, 50 to 90% of pregnant women show some degree of kidney swelling from this backup. Stagnant urine gives bacteria more time to multiply, which is why UTIs during pregnancy are both more common and more likely to progress to kidney infections.

Diabetes and Immune Defenses

People with diabetes face a notably higher risk of UTIs, and the reason goes deeper than the traditional explanation of sugar in the urine feeding bacteria. Research published in the Journal of Clinical Investigation found that insulin resistance itself suppresses the production of natural antimicrobial compounds in the urinary tract. These compounds, which are regulated by insulin signaling, normally kill bacteria that reach the kidneys. When insulin signaling is impaired, the urinary tract becomes a less hostile environment for invading microbes.

Studies in mice with insulin resistance but normal blood sugar levels still showed impaired ability to fight off E. coli in the urinary tract, confirming that glucose in urine isn’t the whole story. For people with diabetes, a lower urinary tract infection has a higher likelihood of progressing to kidney infection, kidney abscess, or more severe complications. This makes early treatment especially important.

When Urine Flows the Wrong Way

In some people, a structural issue called vesicoureteral reflux allows urine to flow backward from the bladder up toward the kidneys. Normally, the section of ureter that passes through the bladder wall gets compressed during urination, creating a one-way valve. If this segment is too short or the surrounding muscle doesn’t function properly, the valve fails and urine (along with any bacteria in the bladder) gets pushed upward.

This reflux is a major pathway to kidney infections. Research in animal models shows that reflux combined with bacterial infection drives serious kidney damage, while reflux alone, without bacteria, does not cause the same harm. Vesicoureteral reflux is most common in children and is a key reason pediatric UTIs are taken seriously and often investigated with imaging.

Recurrent UTIs

Recurrent UTIs are formally defined as two separate episodes of bladder infection within a six-month period. Updated 2025 guidelines from the American Urological Association specify that each episode should be confirmed with evidence of both inflammation and the presence of UTI-causing bacteria, not just symptoms alone. This distinction matters because other conditions can mimic UTI symptoms.

For women dealing with recurrent infections, cranberry products have shown modest benefit, but the details matter. A meta-analysis in Frontiers in Nutrition found that cranberry products significantly reduced UTI risk only when used consistently for 12 to 24 weeks, and only when they contained a meaningful dose of proanthocyanidins (the active compounds). Products with less than 36 milligrams of proanthocyanidins daily showed no statistically significant benefit. Short courses under 12 weeks also didn’t move the needle. In other words, cranberry can help, but only with the right dose taken long enough to make a difference.