Calcium carbonate is a chemical compound with the formula CaCO3. It is a common substance found in rocks as the minerals calcite and aragonite (most notably as limestone, which is a type of sedimentary rock consisting mainly of calcite) and is the main component of pearls and the shells of marine organisms, snails, and eggs. Calcium carbonate is the active ingredient in agricultural lime and is created when calcium ions in hard water react with carbonate ions to create limescale. It is medicinally used as a calcium supplement or as an antacid, but excessive consumption can be hazardous and cause poor digestion.