  The gradient flow in QCD is treated perturbatively through
next-to-next-to-leading order in the strong coupling constant. The evaluation
of the relevant momentum and flow-time integrals is described, including
various means of validation. For the vacuum expectation value of the action
density, which turns out to be a useful quantity in lattice calculations, we
find a very well-behaved perturbative series through NNLO. Quark mass effects
are taken into account through NLO. The theoretical uncertainty due to
renormalization scale variation is significantly reduced with respect to LO and
NLO, as long as the flow time is smaller than about 0.1 fm.
