Modulo 10
Some sources indicate that all MSI bar codes contain a modulo 10 check digit. However, other sources indicate that
the bar code may use either Modulo 10, Modulo 11, or both.
In any case, this is not a normal Modulo 10 as you are probably used to-it's a rather strange process. To calculate
the modulo 10 checksum digit, use the following steps:
- Create a new number using every other digit from the original code such that the right-most digit of the new
number is the right-most digit of the old number. For example, in the bar code above the data we encoded was
"8052". In this case, the "new number" is 02.
- Take the new number calculated in step 1 and multiply it by 2. In this case, 02 * 2 is 4.
- Add the digits of the value calculated in the previous step (4), and add it to the digits that were not used in
step 1 to form the new number. In our example, this would be 4 + 8 + 5 = 17. The "4" comes from step 2, the 8
and 5 come from the "8052" and are the digits that weren't used to form the new number in step 1. If the result
from step 2 were, for example, 123, then we'd add 1 + 2 + 3 = 6 (plus the digits that weren't used from step 1).
- Do a modulo 10 calculation on the result of step 3. In this case, 17 modulo 10 = 7.
- The check digit is the value which, added to the result in step 4, equals 10. In this case, we must add 3 to 7
to get 10-so the check digit is 3. This explains why the example bar code above has a trailing "3" on it.
2 Modulo 10
The "2 Modulo 10" method essentially means the MSI bar code has two Modulo 10 checksum digits. The first Modulo 10
checksum digit is calculcated as described above and appended to the bar code.
The second Modulo 10 checksum digit is calculcated by taking the new bar code (including the first modulo 10 checksum
digit) and repeating the modulo 10 checksum digit process. You are essentially performing a modulo 10 checksum on the
bar code that already has a single modulo 10 checksum appended to it. This checksum digit is appended after the first
checksum digit.
Modulo 11
Another method used to calculate a check digit is a Modulo 11 approach. This approach is significantly different than
the method used to calculate the Modulo 10 check digit above. To calculate the Modulo 11 check digit, use the following
process:
- 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 (i.e., weighting goes from 2 to 7 and then wraps around back to 2).
- Multiply the value of each character by its weight, and sum the result of all the characters.
- Perform a modulo 11 on the result of step 2.
- The modulo 11 checksum is that value which must be added to the result of step 3 in order to arrive at a total of 11.
For example, if the original message was 80523, the modulo 11 checksum digit would be calculated as follows:
| MESSAGE |
8 |
0 |
5 |
2 |
3 |
| Weight |
6 |
5 |
4 |
3 |
2 |
| Weighted Value |
48 |
0 |
20 |
6 |
6 |
Above, we've multiplied each character in the message by its weight depending on its position. We then sum the weighted
values 48 + 0 + 20 + 6 + 6 = 80. 80 modulo 11 is 3. The number which must be added to 3 to arrive at 11 is 8, so the
checksum digit is 8.
Modulo 11/Modulo 10
Another method that implements a double checksum involves taking the original bar code and running it through the
Modulo 11 checksum digit process. The calculcated checksum is then apended to the bar code.
The new bar code, with the modulo 11 checksum appended, is then run through the modulo 10 checksum process. The
calculcated checksum is then appended to the new bar code such that the bar code consists of the original data followed
by a modulo 11 checksum digit followed by a modulo 10 checksum digit.