The goal of the paper is to prove an exact representation formula for the Laplacian of the distance (and more generally for an arbitrary 1-Lipschitz function) in the framework of metric measure spaces satisfying Ricci curvature lower bounds in a synthetic sense (more precisely in essentially nonbranching MCP.K; N/-spaces). Such a representation formula makes apparent the classical upper bounds together with lower bounds and a precise description of the singular part. The exact representation formula for the Laplacian of a general 1-Lipschitz function holds also (and seems new) in a general complete Riemannian manifold.