Check digit

The check digit property is characteristic for barcodes of some types, in particular, Code 39, Interleaved 2 of 5 and Codabar types. The barcode with the check digit has the following symbol structure: quiet zone, start symbol, actual digit, check digit, stop symbol, quiet zone.

Check digit calculation for Codabar type

The check digit is calculated according to Modulo 16. The calculated number is again a symbol of the reference table.

Example

Start and stop symbol each "A"
Actual digit A 1 2 3 4 A
Reference digits 16 1 2 3 4 16
Sum of ref. digits 42
Modulo 16: 42/16 = 2, rest 10
Difference to 16: 16 – 10 = 6
Check digit is "6" = reference digit for 6
Total character string is A 1 2 3 4 6 A

Check digit calculation for Code 39 type

The check digit is calculated according to Modulo 43.

Here is how to do the check digit calculation:

  1. Take the value (0 through 42) of each character in the barcode excluding start and stop codes.
  2. Sum the values.
  3. Divide the result by 43.
  4. The remainder is the value of the check digit character to be appended.

Example

Actual digit + 1 1 10 0 0 1 1 1 1
Reference digits 41 1 1 1 0 0 01 1 1 1
Sum of ref. digits is 48
48/43=1, remainder 5
Check digit is 5
Total character string + 1 1 1 0 0 0 1 1 1 1 5

Check digit calculation for Interleaved 2 of 5 type

  1. Start with the right-most digit in the message; mark the characters with even and odd position. The right-most digit has the even position.
  2. Sum all digits in the odd position, and then multiply by 3.
  3. Sum all digits in the even position.
  4. Add the results from step 2 and step 3.
  5. Divide the result of step 4 by 10. The check digit is equal to 10 minus the remainder.

Example

Actual digit 4 4 43 3 3 3
Sum of all digits in the odd position S1=14
Sum of all digits in the even position S2=10
S1*3+S2=52
52/10=5, remainder 2
Check digit is 10-2=8
Total character string 4 4 4 3 3 3 38