Gallstones form when liquid stored in the gallbladder hardens into pieces of stone-like material.
The liquid, called bile, is used to help the body digest fats. Bile is made in the liver, then stored in the gallbladder until the body needs to digest fat. Bile contains water, cholesterol, fats, bile salts, and bilirubin. Bile salts break up fat, and bilirubin gives bile and stool a brownish color. If the liquid bile contains too much cholesterol, bile salts, or bilirubin, it can harden into stones.