Despite the fact that the integral form of the equations of classical electrodynamics is well known, the same is not true for non-abelian gauge theories. The aim of the present paper is threefold. First, we present the integral form of the classical Yang-Mills equations in the presence of sources, and then use it to solve the long standing problem of constructing conserved charges, for any field configuration, which are invariant under general gauge transformations and not only under transformations that go to a constant at spatial infinity. The construction is based on concepts in loop spaces and on a generalization of the non-abelian Stokes theorem for two-form connections. The third goal of the paper is to present the integral form of the self dual Yangs-Mills equations, and calculate the conserved charges associated to them. The charges are explicitly evaluated for the cases of monopoles, dyons, instantons and merons, and we show that in many cases those charges must be quantized. Our results are important in the understanding of global properties of non-abelian gauge theories.