We analyse the Gottlieb groups of function spaces. Our results lead to explicit decompositions of the Gottlieb groups of many function spaces map(X, Y )-including the (iterated) free loop space of Y -directly in terms of the Gottlieb groups of Y . More generally, we give explicit decompositions of the generalised Gottlieb groups of map(X, Y ) directly in terms of generalised Gottlieb groups of Y . Particular cases of our results relate to the torus homotopy groups of Fox. We draw some consequences for the classification of T -spaces and G-spaces. For X , Y finite and Y simply connected, we give a formula for the ranks of the Gottlieb groups of map(X, Y ) in terms of the Betti numbers of X and the ranks of the Gottlieb groups of Y . Under these hypotheses, the Gottlieb groups of map(X, Y ) are finite groups in all but finitely many degrees.