The invention relates to a method, system and device for generating an anti-counterfeiting code through a product number and a storage medium, and belongs to the technical field of anti-counterfeiting code generation methods. The method comprises the following steps: S1, generating a unique number P for a product number according to a preset rule, and obtaining a value N for a product sequence number in a preset length range; s2, AES encryption operation is carried out on the product number P and the product sequence number N, and an authentication code is obtained after a modulo algorithm is carried out; s3, combining the product number, the product sequence number and the authentication code into a plain code; s4, performing full-code conversion on the plain code to obtain an anti-counterfeiting code array; step S5, converting the anti-counterfeiting code array into an anti-counterfeiting code; the system comprises a character string generation module, an authentication code generation module, a plain code generation module, an anti-counterfeiting code array generation module and an anti-counterfeiting code generation module. The device comprises a memory and a processor; a computer program is stored on the readable storage medium, and the steps of the method are implemented when the computer program is executed; the encryption strength is high, and cracking is not easy.