This lecture covers the theoretical principles and spectral characteristics of undulators in synchrotrons and x-ray free-electron lasers. Topics include the transition from wigglers to undulators, conditions for constructive interference, and real undulator spectra at third-generation facilities.