We derive the one-loop beta functions for a theory of gravity with generic action containing up to four derivatives. The calculation is done in arbitrary dimension and on an arbitrary background. The special cases of three, four, near four, five and six dimensions are discussed in some detail. In all these dimensions there are nontrivial UV fixed points (FPs), which mean that within the approximations there are asymptotically safe trajectories. We also find an indication that a Weyl-invariant FP exists in four dimensions. The new massive gravity in three dimensions does not correspond to a FP.