The invention belongs to the technical field of 3D printing equipment detection and discloses an online monitoring device for the surface hardness of a 3D printing part in a forming process. The device comprises a workbench, a laser, a spectrograph, a light path device, a reflector, an electric control displacement device, a computer and a support. The electric control displacement device, the laser and the support are sequentially arranged on the workbench, the laser is arranged below the reflector, the light path device is arranged on one side of the electric control displacement device, andthe computer is arranged above the workbench. The invention further discloses a detection method. The device is mounted in a forming chamber of 3D printing equipment, the pulse laser irradiation canbe performed on a formed part of the part in real time to generate plasma, plasma spectrum data are collected to evaluate the surface hardness of the formed part, a condition that the overall surfacehardness of the 3D printing part meets a design requirement is ensured through online real-time hardness detection, and the phenomenon that the hardness does not reach a standard due to unpredictablefactors in the forming process is avoided.