Graphene quantum dots (GQDs) have attracted increasing interest because of their excellent properties such as strong photoluminescence, excellent biocompatibility and low cost. Herein, we develop a general method for the synthesis of doped and undoped GQDs, which relies on direct carbonization of organic precursors in the solid state.