High-performance photovoltaic cells use semiconductors to convert sunlight into clean electrical power, and transparent dielectrics or conductive oxides as antireflection coatings. A common feature of these materials is their high refractive index. Whereas high-index materials in a planar form tend to produce a strong, undesired reflection of sunlight, high-index nanostructures afford new ways to manipulate light at a subwavelength scale. For example, nanoscale wires, particles and voids support strong optical resonances that can enhance and effectively control light absorption and scattering processes. As such, they provide ideal building blocks for novel, broadband antireflection coatings, light-trapping layers and super-absorbing films. This Review discusses some of the recent developments in the design and implementation of such photonic elements in thin-film photovoltaic cells.