Opal is primarily composed of a solution of silicon dioxide and water. As water runs down through the earth, it picks up silica from sandstone, and carries this silica-rich solution into cracks and voids, caused by natural faults or decomposing fossils. Once the water evaporates, it leaves behind a silica deposit. This cycle repeats over very long periods of time, and eventually opal is formed.
Opal is formed from tiny silica spheres, contained in silica-rich solutions in the earth form and settle under gravity in a void to form layers of silica spheres. The solution is believed to have a rate of deposition of approximately one centimetre thickness in five million years at a depth of forty metres. When the spheres are the same size and are arranged in a three-dimensional grid, negatively charged areas are created in the gaps between the spheres. If those negatively charged areas are as big as a wavelength of visible light, then colors will be visible. For precious opal the sphere size ranges from approximately 150 to 400 nanometres producing a play of colour by diffraction in the visible light range of 400 to 700 nanometres.