Moiré lattices consist of two superimposed identical periodic structures with a relative rotation angle. Moiré lattices have several applications in everyday life, including artistic design, the textile industry, architecture, image processing, metrology and interferometry. For scientific studies, they have been produced using coupled graphene–hexagonal boron nitride monolayers1,2, graphene–graphene layers3,4 and graphene quasicrystals on a silicon carbide surface5. The recent surge of interest in moiré lattices arises from the possibility of exploring many salient physical phenomena in such systems; examples include commensurable–incommensurable transitions and topological defects2, the emergence of insulating states owing to band flattening3,6, unconventional superconductivity4 controlled by the rotation angle7,8, the quantum Hall effect9, the realization of non-Abelian gauge potentials10 and the appearance of quasicrystals at special rotation angles11. A fundamental question that remains unexplored concerns the evolution of waves in the potentials defined by moiré lattices. Here we experimentally create two-dimensional photonic moiré lattices, which—unlike their material counterparts—have readily controllable parameters and symmetry, allowing us to explore transitions between structures with fundamentally different geometries (periodic, general aperiodic and quasicrystal). We observe localization of light in deterministic linear lattices that is based on flat-band physics6, in contrast to previous schemes based on light diffusion in optical quasicrystals12, where disorder is required13 for the onset of Anderson localization14 (that is, wave localization in random media). Using commensurable and incommensurable moiré patterns, we experimentally demonstrate the two-dimensional localization–delocalization transition of light. Moiré lattices may feature an almost arbitrary geometry that is consistent with the crystallographic symmetry groups of the sublattices, and therefore afford a powerful tool for controlling the properties of light patterns and exploring the physics of periodic–aperiodic phase transitions and two-dimensional wavepacket phenomena relevant to several areas of science, including optics, acoustics, condensed matter and atomic physics.