Sedimentary Rock
Before we talk about Limestone, which is a sedimentary rock, we must first understand what sedimentary rocks are
Sedimentary rocks are formed from pre-existing rocks or pieces of once-living organisms. They form from deposits that accumulate on the Earth's surface. (This heavily relates to limestone formation that we will be diving into).
Common sedimentary rocks include sandstone, limestone (no surprise here), and shale. These rocks often start as sediments carried in rivers and deposited in lakes and oceans. When buried, the sediments lose water and become cemented to form rock.
Clastic sedimentary rocks may have particles ranging in size from microscopic clay to huge boulders. Their names are based on their clast or grain size.
The smallest grains are called clay, then silt, then sand. "Grains larger than 2 millimeters are called pebbles. Shale is a rock made mostly of clay, siltstone is made up of silt-sized grains, sandstone is made of sand-sized clasts, and conglomerate is made of pebbles surrounded by a matrix of sand or mud" ("What are Sedimentary Rocks?", USGS).
Limestone is a biological sedimentary rock and it can be formed in two ways, before we get to that, we'll talk about the chemical components within it. Limestone contains about 50% calcium carbonate, the formula is CaCO3. There is also a fossiliferous limestone, that occurs with coral and other living organisms that allows them to be fossilized.
The main creation of limestone is a "chemically precipitated limestone that comes from water," and fossiliferous limestone would come from "the build-up of the hard parts of marine organisms" ("Lambert Fieldhouse...", Purdue Arboterum). As mentioned before, certain marine organisms, such as coral and other organisms "remove calcium carbonate from their watery environment to make the hard parts of their bodies. When the marine organisms die, these hard parts collect on the sea floor and become limestone" ("Lambert Fieldhouse...", Purdue Arboterum).