1. Crystallization from a melt: This process happens when molten rock (magma or lava) cools and solidifies. As the temperature drops, the atoms in the melt begin to arrange themselves into specific, repeating patterns, forming crystals. This is how igneous rocks like granite and basalt are formed.
2. Precipitation from a solution: This process occurs when dissolved minerals in a solution become supersaturated, meaning the solution can't hold any more dissolved minerals. As the solution evaporates or cools, the minerals start to precipitate out of the solution and form crystals. This is how sedimentary rocks like limestone and halite (rock salt) are formed.