Onyx is a form of chalcedony, a type of quartz. It forms from layers of chalcedony in volcanic rock fissures, compacting over time to create its characteristic banded appearance.