Crystallization is the process where a solid forms out of a liquid or gas. It occurs when the molecules or ions slowly arrange themselves in a regular repeating pattern known as a crystal lattice. This transition from a disordered liquid or gas to an ordered crystal structure results from a decrease in free energy that allows the atoms or molecules to settle into the most stable configuration.