Most UTIs are caused by bacteria. But they may also be caused by viruses or fungi. Bacteria from the bowel are the most common source of infection. An infection may be more likely due to any of these:
- Having sex. During sex, bacteria can go from the penis, vagina, or rectum into the urethra.
- Bacteria outside the rectum getting into the urethra. Bacteria on the skin outside the rectum may go into the urethra. This is more common in people who were assigned female at birth. That's because, for them, the rectum and urethra are closer to each other than in people who were assigned male at birth. Wiping from front to back after using the toilet can help prevent germs from getting to the urethra. So can keeping the area clean.
- Blocked urine flow through the urinary tract. If urine sits too long, germs may start to grow out of control.
- A new sex partner within the last year.
- A history of recurrent UTIs and antibiotic use.
- Use of spermicide and diaphragm.