The present invention relates to a laser coding method and device, which are used for laser coding on cigarettes, comprising the following steps: S1, identifying the one-dimensional code on the cigarettes, and obtaining the type of the cigarettes; image, and obtain the posture information of the cigarette according to the cigarette image, determine the area suitable for coding, and record the position coordinates of the area; wherein, the posture information of the cigarette includes the distribution of the front and back feature positions of the cigarette and the inclination angle; S3. According to the posture information of the cigarette, control the marking mechanism to perform position compensation, and mark the code matching the type of the cigarette in the area according to the position coordinates. In this way, there is no need to correct the position of the cigarette, and only need to control the marking mechanism to perform position compensation, so that the flexible coding can be realized according to the actual posture of the cigarette, and the coding efficiency can be improved. In addition, the codes are all marked in the area suitable for coding, which improves the clarity of the code and facilitates identification.