Sometimes ‘UPCs’ appear in our database which are not actually valid. This is usually because sellers have entered them incorrectly when listing inventory in online stores. Though why those online stores do not validate the UPC we are not sure. We check the validity of the UPC/barcode on our site and either display the message ‘UPC-A barcode valid‘, or else one of two error messages:
Barcode invalid – UPC must have 12 digits. Pretty much what it says. If a UPC doesn’t have 12 digits then it is wrong to begin with. Very often the problem is a 0 missing from the beginning because retailers think the leading 0 doesn’t matter (it does), or maybe Excel or some other software strips it out for them. That’s not to say products will not be listed for that UPC for reasons outlined above, but it will not be a valid UPC and the barcode won’t scan in most systems
Barcode invalid – checksum incorrect. The barcode is of the correct length – 12 digits – but the checksum does not check out. If you are unfamiliar with the concept of a checksum, basically it usually involves a single digit (the rightmost, in the case of UPCs and most other barcodes) which is derived from an algorithm performed on the remaining 11 digits. If any of the digits are wrong then the checksum won’t be correct. Or to put it another way, if the checksum is wrong then we know a digit in the UPC itself is wrong. It’s far from being a perfect method – collisions (false positives) are very possible, but usually if just one digit has been wrongly typed in or something then the algorithm will catch it. If you are interested, this is the formula that is used to calculate the checksum for UPCs:
- Take the digits in the odd-numbered positions (1st, 3rd, 5th etc.), add them together and multiply the result by three.
- Take the digits in the even-numbered positions (2nd, 4th, 6th – but NOT the 12th digit to the right if it is there, since this will be the existing checksum) and add these to the result.
- Divide this result by 10 and take the remainder (modulo 10), and if it is not 0, subtract it from 10 to derive the check digit, otherwise use 0.
We are working on an online UPC validation tool which will demonstrate this process, so look out for that.