Phase-change materials are of immense importance for optical recording and computer memory, but the structure of the amorphous phases and the nature of the phase transition in the nanoscale bits pose continuing challenges. Massively parallel density functional simulations have been used to characterize the amorphous structure of the prototype materials Ge 2 Sb 2 Te 5 and GeTe. In both, there is long-ranged order among Te atoms and the crucial structural motif is a four-membered ring with alternating atoms of types A ͑Ge and Sb͒ and B ͑Te͒, an "ABAB square." The rapid amorphous-to-crystalline phase change is a reorientation of disordered ABAB squares to form an ordered lattice. There are deviations from the "8 − N rule" for coordination numbers, with Te having near threefold coordination. Ge atoms are predominantly fourfold coordinated, but-contrary to recent speculation-tetrahedral coordination is found in only approximately one-third of the Ge atoms. The average coordination number of Sb atoms is 3.7, and the local environment of Ge and Sb is usually "distorted octahedral" with AB separations from 3.2 to 4 Å in the first coordination shell. The number of A -A bonds is significantly greater in GeTe than in Ge 2 Sb 2 Te 5 . Vacancies ͑voids͒ in the disordered phases of these materials provide the necessary space for the phase transitions to take place. The vacancy concentration in Ge 2 Sb 2 Te 5 ͑11.8%͒ is greater than in GeTe ͑6.4%͒, which is consistent with the better phase-change performance of the former.