## 2.4. MSI Barcode Format

Table 2.1. MSI Barcode Format

Format start character Any number of digits Checksum digit(s) A stop character
Explanation a wide bar followed by a narrow space Digits 5 modes:
• No check digit (least common)
• Mod 10 (most common)
• Mod 11
• Mod 1010
• Mod 1110
narrow bar, a wide space, then a narrow bar
Digits/Bits Bit: 1 Digits: XXX... Digit(s): X/XX Bits: 00

### 2.4.1. Checksum digit(s)

The MSI barcode uses one of five possible schemes for calculating a check digit:

• No check digit (least common)
• Mod 10 (most common)
• Mod 11
• Mod 1010
• Mod 1110

#### 2.4.1.1. Mode 10 and Mode 1010

The checksum algorithm for Mode 10 is to use “Luhn algorithm”:

1. Counting from the check digit, which is the rightmost one, and moving left, double (x 2) the value of every second digit.
2. Sum the digits of the products (eg, 10 ⇒ 1+0 = 1, 14 ⇒ 1+ 4 =5) together with the un-doubled digits from the original number
3. Got the sum, then do: sum Mod 10 = check digit

Assume an example of an account number "1234567" that will have a check digit added, making it of the form “1234567X”:

Then the steps to calculate the X are:

Table 2.2. Mode 10 Check Digit Example

Example 1 2 3 4 5 6 7 Mode 10 Check digit
(1) Append X 1 2 3 4 5 6 7 X
(2) From rightmost, every second digit × 2 2   6   10   14
(3) List all 2 2 6 4 1+0 6 1+4
(4) Got Summary Sum=2+2+6+4+1+0+6+1+4=26, 26 Mod 10 = 4 X = 4
(5)Result 12345674

For the second checksum digit, the calculation method is still the same, just take the “12345674” as the input number, the calculate the X for “12345674X

##### 2.4.1.1.1. Mode 1010 Example

Table 2.3. Mode 1010 Check Digit Example

Example 1 2 3 4 5 6 7 4 Mode 1010 Check digit
(1) Append X 1 2 3 4 5 6 7 4 X
(2) From rightmost, every second digit × 2   4   8   12   8
(3) List all 1 4 3 8 5 1+2 7 8
(4) Got Summary Sum=1+4+3+8+5+1+2+7+8=39, 39 Mod 10 = 1 X = 1
(5)Result 123456741

#### 2.4.1.2. Mode 11

To calculate the Modulo 11 check digit, use the following process:

1. Assign a weight to each character in the code, starting with a weight of 2 in the right-most position and incrementing by one as you move to the left. After you reach a weight of 7, the next digit will have a weight of 2 (that is, weighting goes from 2 to 7 and then wraps around back to 2)
2. Multiply the value of each character by its weight, and sum the result of all the characters
3. Perform a modulo 11 on the result (sum) of step 2

Assume an example of an account number "1234567" that will have a mode 11 check digit added, making it of the form “1234567X”:

Table 2.4. Mode 11 Check Digit Example

Example 1 2 3 4 5 6 7 Mode 11 Check digit
(1) Add weight 2 7 6 5 4 3 2 X
(2) digit × weight 2 14 18 20 20 18 14
(3)add all, get sum Sum=2+14+18+20+20+18+14=106, 106 Mod 11 = 4 X = 4
(4)Result 12345674

And for the mode 1110, take “1234567”as example, just to use the mode 11 for “1234567”to calculate the first mode 11 check digit, is 4, then do mode 10 for “12345674”then calculate out the second mode 10 check digit, is 1, so the whole result is “123456741

Tip While most MSI barcodes include at least one checksum digit, so in many case, the printed MSI barcode does not show out the first checksum digit, while only show the second checksum digit if exists.