In quantum field theory, the vacuum is a fluctuating medium which behaves as a nonlinear polarizable material. In this article, we perform the first rigorous derivation of the magnetic Euler-Heisenberg effective energy, a nonlinear functional that describes the effective fluctuations of the quantum vacuum in a classical magnetic field.We start from a classical magnetic field in interaction with a quantized Dirac field in its ground state, and we study a limit in which the classical magnetic field is slowly varying. After a change of scales, this is equivalent to a semi-classical limit → 0, with a strong magnetic field of order 1/ . In this regime, we prove that the energy of Dirac's polarized vacuum converges to the Euler-Heisenberg functional. The model has ultraviolet divergences, which we regularize using the Pauli-Villars method. We also discuss how to remove the regularization of the Euler-Heisenberg effective Lagrangian, using charge renormalization, perturbatively to any order of the coupling constant.