A kidney infection happens when bacteria enters and infects one or both of your kidneys. The bacteria are usually a type called E. coli, which live in your bowel.
The bacteria get in through the opening of the urethra and move upwards through your urinary tract, first infecting your bladder and then your kidneys.
It's thought that one way the bacteria get into your urinary tract is by accidentally spreading from your anus to your urethra. This can happen if you wipe your bottom after going to the toilet and the soiled toilet paper comes into contact with your genitals. It can also happen during sex.
In rare cases, a kidney infection can develop if bacteria or fungi infect the skin and the infection spreads through your bloodstream and into your kidney. However, this type of infection usually only occurs in people with weakened immune systems.
Who's most likely to get a kidney infection?
Women and children are most at risk of developing a kidney infection, as well as other urinary tract infections (UTIs) such as cystitis.
In women, the urethra is closer to the anus than it is in men, making it easier for bacteria from the anus to enter the urethra accidentally. The female urethra is also much shorter than the male urethra (which runs through the penis). This makes it easier for bacteria to reach the bladder and move into the kidneys.
Other factors can also put you more at risk of developing a kidney infection, including:
- having a condition that blocks, or obstructs, your urinary tract, such as kidney stones or an enlarged prostate – children with constipation can also be at an increased risk
- being born with an abnormality in your urinary tract
- having a condition that prevents you emptying your bladder fully, such as an injury to your spinal cord – this can allow any bacteria in your bladder to multiply and spread
- having a weakened immune system – for example, due to type 2 diabetes, or as a side effect of treatments that weaken the immune system, such as chemotherapy
- having an infection of the prostate gland called prostatitis – the infection can spread from the prostate gland into the kidneys
- having a urinary catheter (a thin, flexible tube that's inserted into your bladder to drain away urine)
- being female and sexually active – sexual intercourse can irritate the urethra and allow bacteria to travel more easily through it into your bladder
- being a man who has anal sex – bacteria can travel up the urethra into the bladder
- being pregnant – this can cause physical changes that slow the flow of urine out of your body and make it easier for bacteria to spread to the kidneys