We propose a new method for limiting the gradients in a mesh size function by solving a non-linear partial differential equation on the background mesh. Our gradient limiting Hamilton-Jacobi equation simplifies the generation of mesh size functions significantly, by decoupling size constraints at specific locations from the mesh grading requirements. We derive an analytical solution for convex domains which shows the results are optimal, and we describe how to implement efficient solvers on various types of meshes. We demonstrate our size functions with a proposed new mesh generation algorithm, using examples with curvature, feature size, and numerical adaptation.