Many nonlinear partial differential equations (PDEs) display a coarsening dynamics, i.e., an emerging pattern whose typical length scale $L$ increases with time. The so-called coarsening exponent $n$ characterizes the time dependence of the scale of the pattern, $L(t)\approx t^n$, and coarsening dynamics can be described by a diffusion equation for the phase of the pattern. By means of a multiscale analysis we are able to find the analytical expression of such diffusion equations. Here, we propose a recipe to implement numerically the determination of $D(\lambda)$, the phase diffusion coefficient, as a function of the wavelength $\lambda$ of the base steady state $u_0(x)$. $D$ carries all information about coarsening dynamics and, through the relation $|D(L)| \simeq L^2 /t$, it allows us to determine the coarsening exponent. The main conceptual message is that the coarsening exponent is determined without solving a time-dependent equation, but only by inspecting the periodic steady-state solutions. This provides a much faster strategy than a forward time-dependent calculation. We discuss our method for several different PDEs, both conserved and not conserved.