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. At that time, the gallbladder contracts and pushes the bile into a tube called a duct that carries it to the small intestine, where it helps with digestion. 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. The two types of gallstones are cholesterol stones and pigment stones. Cholesterol stones are usually yellow-green and are made primarily of hardened cholesterol. They account for about 80 percent of gallstones. Pigment stones are small, dark stones made of bilirubin.