The nonlinear optical properties of carbon dots have been in the spotlight in recent years. In light of the complexity and diversity of factors affecting the nonlinear optical properties of carbon dots, how to reveal the origin and physical mechanism of the nonlinear optical properties of carbon dots accurately has become a problem. In this work, a template-free method was designed to prepare carbon dots via solid-phase reaction with phloroglucinol as a single carbon source and sodium bisulfate as the catalyst. This method is simple, green, safe, and easy to be prepared on a large scale. Three carbon dots with different luminous colors were obtained by simply adjusting the reaction temperature. The rise of reaction temperature affects the surface functional groups, and then hinders the luminescence of surface states, leading to the change of luminescence properties. The nonlinear optical properties of carbon dots were analyzed by the Z-scan technique. Surprisingly, all carbon dots have nonlinear optical responses, but there are differences in performance. Results prove the increase in sp2 domains may contribute to the significant improvement of the nonlinear optical properties of carbon dots, indicating a direction to improve the nonlinear optical properties of carbon dots.