Phase-change materials (PCMs) are promising candidates for novel data-storage and memory applications. They encode digital information by exploiting the optical and electronic contrast between amorphous and crystalline states. Rapid and reversible switching between the two states can be induced by voltage or laser pulses. Here, we review how density-functional theory (DFT) is advancing our understanding of PCMs. We describe key DFT insights into structural, electronic, and bonding properties of PCMs and into technologically relevant processes such as fast crystallization and relaxation of the amorphous state. We also comment on the leading role played by predictive DFT simulations in new potential applications of PCMs, including topological properties, switching between different topological states, and magnetic properties of doped PCMs. Such DFT-based approaches are also projected to be powerful in guiding advances in other materials-science fields.