Your liver makes bile out of materials it filters from your blood. These materials include cholesterol, bilirubin, bile salts and lecithin. Gallstones occur when there’s too much of one of these — usually cholesterol, but sometimes bilirubin — and the excess materials turn into a kind of sediment. The sediment collects at the bottom of your gallbladder or your common bile duct and eventually hardens. The stones gradually grow as sediment continues to wash over them. This takes many years. Most gallstones form in your gallbladder and travel with the flow of bile into your common bile duct.