Stalactites and stalagmites are composed primarily of calcite (CaCO3), a mineral form of calcium carbonate. Over time, water seeping through cracks in the rock picks up minerals, including calcium carbonate, from the surrounding limestone or other carbonate-rich rocks. As the water drips from the ceiling of the cave, it deposits a small amount of calcite, gradually forming a stalactite. When water drops fall to the floor and pool, they deposit layers of calcite that build up stalagmites. Both formations continue to grow over time as mineral-rich water continues to flow and calcium carbonate is deposited layer by layer.