Phase-change memory (PCM) has been researched extensively as a promising alternative to flash memory. Important studies have focused on its scalability, switching speed, endurance, and new materials. Still, reliability issues and inconsistent switching in PCM devices motivate the need to further study its fundamental properties. However, many investigations treat PCM cells as black boxes; nanostructural changes inside the devices remain hidden. Here, using in situ transmission electron microscopy, we observe real-time nanostructural changes in lateral Ge2Sb2Te5 (GST) PCM bridges during switching. We find that PCM devices with similar resistances can exhibit distinct threshold switching behaviors due to the different initial distribution of nanocrystalline and amorphous domains, explaining variability of switching behaviors of PCM cells in the literature. Our findings show a direct correlation between nanostructure and switching behavior, providing important guidelines in the design and operation of future PCM devices with improved endurance and lower variability. © 2011 American Chemical Society.