Bladder stones usually form when you can't completely empty your bladder of urine.
Urine is produced by your kidneys. It's made up of water mixed with waste products that the kidneys remove from your blood.
One of the waste products is urea, which is made up of nitrogen and carbon.
If any urine remains in your bladder, the chemicals in urea will stick together and form crystals. Over time, the crystals will harden and form bladder stones.
This page explains the main reasons why it might not be possible to empty the bladder fully.
The prostate gland is a small gland only found in men. It's found between the penis and the bladder, and surrounds the urethra (the tube through which urine passes out of the body).
Many men experience prostate enlargement as they grow older. Their enlarged prostate can press on the urethra and block the flow of urine from their bladder.
This is normally successfully treated, but the few men who fail to respond to treatment will have an increased risk of developing bladder stones.
Damaged nerves (neurogenic bladder)
Neurogenic bladder is a condition where the nerves that control the bladder are damaged. This prevents a person emptying their bladder fully.
Most people with a neurogenic bladder need to have a tube called a catheter inserted into their bladder to drain it of urine. This process is known as urinary catheterisation.
Even though a catheter is reasonably effective, it often leaves a small amount of urine in the bladder, which can lead to the formation of bladder stones.
A cystocele is a condition that affects women, and occurs when the wall of the bladder becomes weakened and drops down into the vagina. This can block the flow of urine out of the bladder.
A cystocele can develop during a period of excessive straining, such as during childbirth or heavy lifting, or while on the toilet with constipation.
Bladder diverticula are pouches that develop in the wall of the bladder. If the diverticula get too big, it can become difficult for a person to empty their bladder fully.
Bladder diverticula can be present at birth or develop as a complication of infection or prostate enlargement.
Bladder augmentation surgery
Bladder augmentation surgery is where a piece of the bowel is removed and attached to the bladder to make it larger.
It can be a useful way of treating a type of urinary incontinence known as urge incontinence. But it can sometimes be a factor in developing bladder stones.
In the UK it's unusual for bladder stones to be caused by a poor diet, but this is relatively common in parts of the developing world.
This can alter the chemical make-up of urine, making the formation of bladder stones more likely.