What is the minimum number of triangles in a graph of given order and size? Motivated by earlier results of Mantel and Turan, Rademacher solved the first non-trivial case of this problem in 1941. The problem was revived by ErdH{o}s in 1955; it is now known as the ErdH{o}s-Rademacher problem. After attracting much attention, it was solved asymptotically in a major breakthrough by Razborov in 2008. In this paper, we provide an exact solution for all large graphs whose edge density is bounded away from~$1$, which in this range confirms a conjecture of Lovasz and Simonovits from 1975. Furthermore, we give a description of the extremal graphs.