The rock consists for more than 90% of calcite and less than 10% dolomite.
Limestone often contains variable amounts of silica in the form of chert or flint, as well as varying amounts of clay, silt and sand as disseminations, nodules, or layers within the rock.
The primary source of the calcite in limestone is most commonly marine organisms. These organisms secrete shells that settle out of the water column and are deposited on ocean floors as pelagic ooze or alternatively are conglomerated in a coral reef.
Secondary calcite may also be deposited by supersaturated meteoric waters (groundwater that precipitates the material in caves). This produces speleothems such as stalagmites and stalactites. Another form taken by calcite is that of oolites (oolitic limestone) which can be recognized by its granular appearance.
Limestone makes up about 10% of the total volume of all sedimentary rocks. Limestones may also form in both lacustrine and evaporite depositional environments.
Calcite can be either dissolved by groundwater or precipitated by groundwater, depending on several factors including the water temperature, pH, and dissolved ion concentrations. Calcite exhibits an unusual characteristic called retrograde solubility in which it becomes less soluble in water as the temperature increases. When conditions are right for precipitation, calcite forms mineral coatings that cement the existing rock grains together or it can fill fractures.
Karst topography and caves develop in carbonate rocks due to their solubility in dilute acidic groundwater. Cooling groundwater or mixing of different groundwaters will also create conditions suitable for cave formation.
Coastal limestones are often eroded by organisms which bore into the rock by various means. This process is known as bioerosion. It is most common in the tropics, and it is known throughout the fossil record.