Topaz has a chemical composition of Al2SiO4(F,OH)2. The fluorine in its composition is a limiting factor on its formation. Fluorine gas in concentrations high enough to form minerals only occurs in a few geologic environments.

Most topaz grows as crystals within the veins and voids of igneous rocks. This topaz is found in the cavities of a pegmatite, or in the vesicles and intergranular spaces of rhyolite. These topaz crystals grow during the late stages of magma cooling and while degassing releases the fluorine necessary for topaz crystal growth.
Precipitating in cavities, topaz sometimes develops nicely formed crystals. These crystals can have excellent clarity and can be used as a gem material. Many mineral collectors enjoy collecting gem-quality topaz crystals because they have the value of an excellent mineral specimen plus (if they are of rare color) the value of a gem material.

Topaz is also found as water-worn pebbles in stream sediments derived from the weathering of pegmatites and rhyolites. These are often produced by placer mining.