How slightly acidic water dissolves limestone
Rainwater absorbs carbon dioxide as it falls and percolates through soil, forming weak carbonic acid. When this acidic groundwater encounters limestone (calcium carbonate), a chemical reaction dissolves the rock grain by grain. Over thousands of years, this slow dissolution enlarges tiny cracks into passages and chambers.
The process is called karstification. It requires three ingredients: soluble rock (limestone or dolomite), acidic water, and time. Without water flow, dissolution halts. In tropical regions with high rainfall, cave systems grow faster.
Stalactites and stalagmites as records of time
Once a cave chamber opens to air, water dripping from the ceiling deposits mineral layers, building stalactites overhead and stalagmites on the floor. These deposits grow slowly, maybe an inch per century. Their layering can be dated, providing a timeline of the cave's history and past climate conditions.