Disclosed is a two-dimensional code laser marking method and device based on a liquid crystal spatial light modulator. The device mainly comprises a laser device, a polarizer, beam expanding collimation systems, the liquid crystal spatial light modulator, a computer, focusing collimation systems and an imaging lens. Lasers emitted by the laser device pass through the polarizer to become polarized light, the polarized light passes through the beam expanding collimation systems to become parallel light, the parallel light is incident to the liquid crystal spatial light modulator, the liquid crystal spatial light modulator performs image information modulation on the parallel light, a two-dimensional code image output by two-dimensional code generating software generates a kinoform through the computer so as to precisely control a phase image displayed on the liquid crystal spatial light modulator, diffraction light splitting is performed on the parallel light through the image displayed on the liquid crystal spatial light modulator, and therefore the parallel light becomes diffraction light, the light beam of the diffraction light is narrowed and collimated through the focusing collimation systems, and finally the lasers are focused on a workpiece surface required to be marked through a flat-field lens.