Rainwater is a weak acid; it contains dissolved carbon dioxide and humic acids and is capable of dissolving away rock such as limestone.
In limestone regions, streams flowing over what is known as limestone pavement often suddenly disappear underground down a swallow hole. They continue to flow underground sometimes through great cave systems Streams tend to follow a step like path, seeking out the weakest passage along bedding plains and down vertical joints in the lime stone. In the early stage of development of an underground cave system 9phreatic stage), water completely fills the passage and dissolves out a near circular tunnel. As the volume of water increases, the stream widens and cuts down into the bottom of the tunnels; the stream is now free flowing (vadose stage). Eventually, it may open up and follow a new and lower set of passageways, leaving empty, dry caves above it.
The solution of limestone to calcium bicarbonate is reversible. As the saturated water drips from the ceiling or splashes on the floor it evaporates and calcium carbonate precipitates out again, forming stalactites and stalagmites. These may eventually join up to form columns. Sometimes a part of the roof of the passage or cave collapses, opening a pothole or chimney.
Caves are also formed when the sea erodes into the weaker parts of a cliff. Melt water can carve out ice caves in glaciers, and molten lava draining from flow tubes can leave tunnels behind.