In this paper, we compute the rational cohomology groups of the classifying space of a simply connected Kac-Moody group of infinite type. The fundamental principle is "from finite to infinite". That is, for a Kac-Moody group G(A) of infinite type, the input data for computation are the rational cohomology of classifying spaces of parabolic subgroups of G(A)(which are of finite type), and the homomorphisms induced by inclusions of these subgroups. In some special cases, we can further determine the cohomology rings. Our method also applies to study the mod p cohomology of the classifying spaces of Kac-Moody groups.