It is described how the dimensionality of space-time may be used to check the gauge iuvariance of perturbative calculations in pure Yang-Mills (YM) theories. The idea is based on the fact that pure YM theory in two dimensions is perturbatively free. Thus gauge-invariant quantities evaluated in a D-dimensional pure YM theory should vanish as D goes to two. The procedure and various subtleties in its application are illustrated by examples drawn from quarkless QCD at zero and nonzero temperature. The inclusion of quarks and the use of background field gauges is briefly discussed.