Atomic force microscopy (AFM) is a key tool for nanotechnology research and finds its principal application in the determination of surface topography. However, the use of the AFM tip as a probe of electrical properties allows enormous insights into material functionality at the nanoscale. Hence, a burgeoning suite of techniques has been developed to allow the determination of properties such as resistivity, surface potential and capacitance simultaneously with topographic information. This has required the development of new instrumentation, of novel probes and of advanced sample preparation techniques. In order to understand and quantify the results of AFM-based electrical measurements, it has proved important to consider the interplay of topographic and electrical information, and the role of surface states in determining a material's electrical response at the nanoscale. Despite these challenges, AFM-based techniques provide unique insights into the electrical characteristics of ever-shrinking semiconductor devices and also allow us to probe the electrical properties of defects and self-assembled nanostructures.