The Parisi formula is a self-contained description of the infinite-volume limit of the free energy of mean-field spin glass models. We showthat this quantity can be recast as the solution of a Hamilton–Jacobi equation in the Wasserstein space of probability measures on the positive half-line.