A reef is a bar of rock, sand, coral or similar material, lying beneath the surface of water. Many reefs result from natural, abiotic processes—deposition of sand, wave erosion planing down rock outcrops, etc.—but the best known reefs are the coral reefs of tropical waters developed through biotic processes dominated by corals and coralline algae.

Artificial reefs (e.g. shipwrecks) sometimes have a role in enhancing the physical complexity of featureless sand bottoms, in order to attract a diverse assemblage of organisms, especially algae and fish.

Earth's largest reef system is the Great Barrier Reef in Australia, at a length of over 2,300 kilometres (1,400 miles).

There is a variety of biotic reef types, including oyster reefs and sponge reefs, but the most massive and widely distributed are tropical coral reefs. Although corals are major contributors to the framework and bulk material comprising a coral reef; the organisms most responsible for reef growth against the constant assault from ocean waves are calcareous algae, especially, although not entirely, coralline algae.

These biotic reef types take on additional names depending upon how the reef lies in relation to the land, if any. Reef types include fringing reefs, barrier reefs, and atolls. A fringing reef is a reef that is attached to an island. A barrier reef forms a calcareous barrier around an island resulting in a lagoon between the shore and the reef. An atoll is a ring reef with no land present. The reef front (ocean side) is a high energy locale whereas the internal lagoon will be at a lower energy with fine grained sediments.

Ancient reefs buried within stratigraphic sections are of considerable interest to geologists because they provide paleo-environmental information about the location in Earth's history. In addition, reef structures within a sequence of sedimentary rocks provide a discontinuity which may serve as a trap or conduit for fossil fuels or mineralizing fluids to form petroleum or ore deposits.

Corals, including some major extinct groups Rugosa and Tabulata, have been important reef builders through much of the Phanerozoic since the Ordovician Period. However, other organism groups, such as calcifying algae, especially members of the red algae Rhodophyta, and molluscs (especially the rudist bivalves during the Cretaceous Period) have created massive structures at various times. During the Cambrian Period, the conical or tubular skeletons of Archaeocyatha, an extinct group of uncertain affinities (possibly sponges), built reefs. Other groups, such as the Bryozoa have been important interstitial organisms, living between the framework builders. The corals which build reefs today, the Scleractinia, arose after the Permian–Triassic extinction event that wiped out the earlier rugose corals (as well as many other groups), and became increasingly important reef builders throughout the Mesozoic Era. They may have arisen from a rugose coral ancestor. Rugose corals built their skeletons of calcite and have a different symmetry from that of the scleractinian corals, whose skeletons are aragonite. However, there are some unusual examples of well-preserved aragonitic rugose corals in the Late Permian. In addition, calcite has been reported in the initial post-larval calcification in a few scleractinian corals. Nevertheless, scleractinian corals (which arose in the middle Triassic) may have arisen from a non-calcifying ancestor independent of the rugosan corals (which disappeared in the late Permian).