Gauss’s class number one problem, solved by Heegner, Baker, and Stark, asked for all imaginary quadratic fields for which the ideal class group is trivial. An application of this solution gives all elliptic curves that can be defined over the rationals and have a large endomorphism ring (CM). Analogously, to get all CM curves of genus two defined over the smallest number fields, we need to find all quartic CM fields for which the CM class group (a quotient of the ideal class group) is trivial. We solve this CM class number one problem. We prove that the list given in Bouyer–Streng [LMS J Comput Math 18(1):507–538, 2015, Tables 1a, 1b, 2b, and 2c] of maximal CM curves of genus two defined over the reflex field is complete. We also prove that there are exactly 21 simple CM curves of genus two over C that can be defined over Q.