We present a formalism for understanding the electromagnetism of metasurfaces, optically thin composite films with engineered diffraction. The technique, diffractive interface theory (DIT), takes explicit advantage of the small optical thickness of a metasurface, eliminating the need for solving for light propagation inside the film and providing a direct link between the spatial profile of a metasurface and its diffractive properties. Predictions of DIT are compared with full-wave numerical solutions of Maxwell's equations, demonstrating DIT's validity and computational advantages for optically thin structures. Applications of the DIT range from understanding of fundamentals of light-matter interaction in metasurfaces to efficient analysis of generalized refraction to metasurface optimization.