Bile can harden into stones under certain conditions if it contains too much cholesterol or bilirubin. Stones can also form if your gallbladder doesn't empty as it should.