Topology optimization is a computational tool that can be used for the systematic design of photonic crystals, waveguides, resonators, filters and plasmonics. The method was originally developed for mechanical design problems but has within the last six years been applied to a range of photonics applications. Topology optimization may be based on finite element and finite difference type modeling methods in both frequency and time domain. The basic idea is that the material density of each element or grid point is a design variable, hence the geometry is parameterized in a pixel-like fashion. The optimization problem is efficiently solved using mathematical programming-based optimization methods and analytical gradient calculations. The paper reviews the basic procedures behind topology optimization, a large number of applications ranging from photonic crystal design to surface plasmonic devices, and lists some of the future challenges in non-linear applications.