# Check Digit Calculation Method

Some bar code types and modifiers call for the calculation and presentation of check digits. Check digits are a method of verifying data integrity during the bar coding reading process. Except for UPC Version E, the check digit is always presented in the bar code bar and space patterns, but is not always presented in the HRI. The following table shows the check digit calculation methods for each bar code type and the presence or absence of the check digit in the HRI.

Table 1. Check Digit Calculation Methods For Each Bar Code
Bar Code Type Modifier In HRI? Check Digit Calculation
1 – Code 39 (3-of-9 Code), AIM USS-39 X'02' Yes Modulo 43 of the sum of the data characters' numerical values as described in a Code 39 specification. The start and stop codes are not included in the calculation.
2 – MSI (modified Plessey code) X'02' - X'09' No IBM® Modulus 10 check digit:
1. Multiply each digit of the original number by a weighting factor of 1 or 2 as follows: multiply the units digit by 2, the tens digit by 1, the hundreds digit by 2, the thousands digit by 1, and so forth.
2. Sum the digits of the products from step 1. This is not the same as summing the values of the products.
3. The check digit is described by the following equation where sum is the resulting value of step 2: (10 - (sum modulo 10)) modulo 10
IBM Modulus 11 check digit:
1. Multiply each digit of the original number by a repeating weighting factor pattern of 2, 3, 4, 5, 6, 7 as follows: multiply the units digit by 2, the tens digit by 3, the hundreds digit by 4, the thousands digit by 5, and so forth.
2. Sum the products from step 1.
3. The check digit depends on the bar code modifier. The check digit as the remainder is described by the following equation where sum is the resulting value of step 2: (sum modulo 11)

The check digit as 11 minus the remainder is described by the following equation: (11 - (sum modulo 11)) modulo 11

NCR Modulus 11 check digit:
1. Multiply each digit of the original number by a repeating weighting factor pattern of 2, 3, 4, 5, 6, 7, 8, 9 as follows: multiply the units digit by 2, the tens digit by 3, the hundreds digit by 4, the thousands digit by 5, and so forth.
2. Sum the products from step 1.
3. The check digit depends on the bar code modifier. The check digit as the remainder is described by the following equation where sum is the resulting value of step 2: (sum modulo 11)

The check digit as 11 minus the remainder is described by the following equation: (11 - (sum modulo 11)) modulo 11

3 – UPC/CGPC Version A X'00' Yes UPC/EAN check digit calculation:
1. Multiply each digit of the original number by a weighting factor of 1 or 3 as follows: multiply the units digit by 3, the tens digit by 1, the hundreds digit by 3, the thousands digit by 1, and so forth.
2. Sum the products from step 1.
3. The check digit is described by the following equation where sum is the resulting value of step 2: (10 - (sum modulo 10)) modulo 10
5 – UPC/CGPC Version E X'00' Yes See UPC/CGPC Version A
8 – EAN 8 (includes JAN-short) X'00' Yes See UPC/CGPC Version A
9 – EAN 13 (includes JAN-standard) X'00' Yes See UPC/CGPC Version A
10 – Industrial 2-of-5 X'02' Yes See UPC/CGPC Version A
11 – Matrix 2-of-5 X'02' Yes See UPC/CGPC Version A
12 – Interleaved 2-of-5 X'02' Yes See UPC/CGPC Version A
13 – Codabar, 2-of-7, AIM USS-Codabar X'02' No Codabar check digit calculation:
1. Sum of the data characters' numerical values as described in a Codabar specification. All data characters are used, including the start and stop characters.
2. The check digit is described by the following equation where sum is the resulting value of step 1: (16 - (sum modulo 16)) modulo 16
17 – Code 128, AIM USS-128 X'02' No Code 128 check digit calculation:
1. Going left to right starting at the start character, sum the value of the start character and the weighted values of data and special characters. The weights are 1 for the first data or special character, 2 for the second, 3 for the third, and so forth. The stop character is not included in the calculation.
2. The check digit is modulo 103 of the resulting value of step 1.
24 – POSTNET X'00' - X'04' NA The POSTNET check digit is (10 - (sum modulo 10)) modulo 10, where sum is the sum of the ZIP code data.
26 – RM4SCC X'00' NA The RM4SCC checksum digit is calculated by using an algorithm that weights each of the 4 bars within a character in relation to its position within the character.
X'01' NA None.
27 – Japan Postal Bar Code JPOSTAL X'00'

N/A

The Japan Postal Bar Code check digit calculation:

Convert each character in the bar code data into decimal numbers. Numeric characters are converted to decimal. Each hyphen character is converted to the number 10. Each alphabetic character is converted to two numbers according to the symbology definition.

For example, A becomes 11 and 0, B becomes 11 and 1,…, J becomes 11 and 9, K becomes 12 and 0, L becomes 12 and 1, …, T becomes 12 and 9, U becomes 13 and 0, V becomes 13 and 1, …, and Z becomes 13 and 5.

Sum the resulting decimal numbers and calculate the remainder modulo 19.

The check digit is 19 minus the remainder.

X'01' N/A None
28 – DataMatrix (2DMATRIX) X'00' N/A The DataMatrix symbology uses a Reed-Solomon error checking and correcting algorithm.
29 – MaxiCode 2DMAXI X'00' N/A The MaxiCode symbology uses a Reed-Solomon error checking and correcting algorithm.
30 – PDF417 X'00' - X'01' N/A The PDF417 symbology uses a Reed-Solomon error checking and correcting algorithm.
31 – Australia Post Bar Code APOSTAL X'01' - X'08' No The Australian Post Bar Code uses a Reed Solomon error correction code based on Galois Field 64.
32 — QR Code X'02' NA The QR Code symbology uses a Reed-Solomon Error Checking and Correcting (ECC) algorithm.
33 — Code 93 X'00' No Both check digits (C and K) are calculated as Modulo 47 of the sum of the products of the data-character numerical values as described in the Code 93 specification and a weighting sequence. The start and stop codes are not included in the calculation.
34 — USPS Four-State X'00' - X'03' No No check digit exists, but error detection and correction is added as part of the encoding process. See Specifications for the Four-State Barcode.