AFM is a type of scanning probe microscopy that uses a cantilever with a sharp tip to scan the surface of a sample. By measuring the deflection of the cantilever as it interacts with the sample surface, AFM can generate high-resolution images of the surface topography. Unlike electron microscopy, AFM does not require a vacuum environment and can be used to study samples in various conditions, including in liquids and at ambient pressure.