Speleology is the science of exploration and study of all aspects of caves and the environment which surrounds the caves. Exploring a cave for recreation or science may be called caving, potholing, or, in Canada and the United States, spelunking.

The formation and development of caves is known as speleogenesis. Caves are formed by various geologic processes. These may involve a combination of chemical processes, erosion from water, tectonic forces, microorganisms, pressure, atmospheric influences, and even digging.

Most caves are formed in limestone by dissolution.
Solutional caves form in rock that is soluble, such as limestone, but can also form in other rocks, including chalk, dolomite, marble, salt, and gypsum.
The world's most spectacularly decorated cave is generally regarded to be Lechuguilla Cave in New Mexico.

Some caves are formed at the same time as the surrounding rock. These are sometimes called primary caves.
Lava tubes are formed through volcanic activity and are the most common 'primary' caves.
Lava caves, include but are not limited to lava tubes. Other caves formed through volcanic activity include rift caves, lava mould caves, open vertical volcanic conduits, and inflationary caves.

Sea caves are found along coasts around the world. A special case is littoral caves, which are formed by wave action in zones of weakness in sea cliffs.
Corrasional or erosional caves are those that form entirely by erosion by flowing streams carrying rocks and other sediments. These can form in any type of rock, including hard rocks such as granite.

Glacier caves occur in ice and under glaciers and are formed by melting.
Fracture caves are formed when layers of more soluble minerals, such as gypsum, dissolve out from between layers of less soluble rock.
Talus caves are the openings between rocks that have fallen down into a pile, often at the bases of cliffs.
