Barcodes have many formats. UPC-A is the commonly used in the United States. A UPC-A barcode has 12 digits, with one on the leftmost and one on the rightmost separated from two groups of 5 digit numbers. The first group of 5 digits identifies the owner of the barcodes, and the other group of 5 digits can be assigned by the barcode owners
The first digit bears the following meanings.
* 0 - Regular UPC codes
* 2 Variable weight items marked at retail stores
* 3 Drug or health related items
* 4 - Free form barcode for non-food items
* 5 - Used for coupons
* 7 - Regular UPC codes.
The last digit is a Modulo 10 checksum. If enabled, it is a mechanism for checking reading error.
For CD and DVD products, the last digit of the second 5-digit group (or the 11th digit) should tell what kind of product the barcode is. CD products should have this digit set to 2 and DVD products should be 9. If you need to buy barcodes from third party, make sure to request your barcodes with this convention.