Limestone is a sedimentary rock made primarily of calcium carbonate or calcite. The most common source of this calcite is the shells of marine organisms like mollusks, corals, and foraminiferons.
Most limestone is formed in marine environments. Shallow seas that are home to the creatures that use calcite to make their shells are ideal for limestone creation.
Limestone can also form in caves where calcite rich water filters through the earth leaving behind small amounts of calcium carbonate as it passes. Over long periods of time these deposits create stalagtites and stalagmites of limestone.
About 10% of all sedimentary rocks are limestone.