Solving Barcodes: What is a Check Digit & How is it Calculated

0

Check Digit

Human errors represent one of the limiting factors of any workflow, whether it’s for chemical library screening or performing a simple PCR reaction. This is why barcodes and RFID are used in the first place, as a means to mitigate human errors by making item tracking as automated and redundant as possible. Barcodes themselves, such as UPC and Code 128, can also come with a built-in method of preventing human error: the check digit.

 

What is a check digit?

Barcodes are not just collections of randomly assigned numbers. Their sequence serves a specific purpose, highlighted by the check digit. The check digit represents the last digit of the barcode (to the right), calculated from all other digits in the code. It is the weighted sum of all other numbers and is used to preserve data integrity. As barcode readers are not foolproof and can make errors decoding barcodes, check digits can be read by scanners and compared to the previously generated check digit (e.g., those generated by BarTender™) for that sample. If both numbers match, only then will the reader transmit the message and fully scan the item.

How are check digits calculated?

Barcode check digits are calculated using specific algorithms, such as the Luhn algorithm. This algorithm is named after its creator, a scientist working for IBM. The algorithm is in the public domain and is widely used today. However, it is not intended to be used for cryptographic applications; it’s designed to protect against accidental errors, not malicious attacks. Beyond barcodes, this algorithm is even used by most credit cards as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.

While the Luhn algorithm is a specific method of manually calculating check digits, certain sites, like GS1, host calculators automatically compute digits for a series of identifiers, including the Global Trade Item Number (GTIN), Serial Shipping Container Code (SSCC), and Global Location Number (GLN). Other calculators hosted on various sites can also compute UPC and EAN barcode check digits. If you want to calculate the check digit yourself, you can follow the steps below:

 

Let’s use a made-up UPC barcode of 01915248272.

  1. First, add all digits in odd positions: 0 + 9 + 5 + 4 + 2 + 2 = 22
  2. Next, multiply by 3: 22 x 3 = 66
  3. Then, add all digits in even positions: 1 + 1 + 2 + 8 + 7 = 19
  4. Sum the results of steps 2 and 3: 66 + 19 = 85
  5. Determine the number that must be added to the result of step 4 to create a multiple of 10: 85 + 5 = 90

 

Here, the check digit would equal 5, making the barcode read 019152482725. This can be again verified using a check digit calculator:

 

LabTAG by GA International is a leading manufacturer of high-performance specialty labels and a supplier of identification solutions used in research and medical labs as well as healthcare institutions.