We show that the perturbative expansion of general gauge theories can be expressed in terms of gauge invariant variables to all orders in perturbations. In this we generalize techniques developed in gauge invariant cosmological perturbation theory, using Bardeen variables, by interpreting the passing over to gauge invariant fields as a homotopy transfer of the strongly homotopy Lie algebras encoding the gauge theory. This is illustrated for Yang-Mills theory, gravity on flat and cosmological backgrounds and for the massless sector of closed string theory. The perturbation lemma yields an algorithmic procedure to determine the higher corrections of the gauge invariant variables and the action in terms of these.