Check Digits

Most simple check digit schemes seem to rely on modulo 11 computations or are based on some other factor which is prime relative to the base of the digits. One characteristic of these schemes is that they support detection of one-digit errors and adjacent pair digit exchanges. These are the most frequent manual typing mistakes.

ISBN Numbers
Euro Bills
EAN / EPC
Container Number
ISBN Numbers

The 10-digit ISBN number contains nine payload digits and one trailing check digit which is computed as follows: First digit is multiplied by 10, second by 9, third by 8 and so on up to the ninth digits which is multiplied by 2. Products are added. Check digit is the difference to the next higher multiple of 11. Difference of 10 is denoted by check digit "X".

Example: ISBN 3-7707-6257-6 has check digit 6.

ISBN digit Multiplier Product
3x 10=30
-
7x 9=63
7x 8=56
0x 7=0
7x 6=42
-
6x 5=30
2x 4=8
5x 3=15
7x 2=14
-
Sum:258
Next multiple of 11:
24 x 11
264
Check Digit:
264 - 258
6

Interesting further information including country codes and internal structure for English ISBN block (1st digit is 0 or 1) can be found in the comments of http://www.xfront.com/isbn.xsd.


Euro Bills

The serial number on Euro bills conisists of one country character, the payload digits and one check digit. Check digit is negative sum of digits modulo 9 Characters are converted to numbers based on a conversion table (A=11, B=12, C=13, D=14, E=15, F=16, G=17, H=18, I=19, J=20, K=21, L=22, M=23, N=24, O=25, P=26, Q=27, R=28, S=29, T=30, U=31, V=32, W=33, X=34, Y=35, Z=36)

Example: X25277180537 has check digit 7

Example: X = 34; 34 + qs(2527718053) = 34 + 40 = 74; 74 = 8 x 9 + 2; -2 mod 9 = 7.


EAN / UPC

Last digit is the check digit (0-9). To compute the check digit, iterate the digits from right to left, starting left of the check digit, and multiply with 3 and 1, alternating. Check digit is then set to the difference to next higher multiple of 10. If the product sum is evenly divisible by ten, the check digit is "0".

Example: EAN (EAN-13) 4-007192-578962 has check digit 2.

EAN digit Multiplier Product
4x 1=4
-
0x 3=0
0x 1=0
7x 3=21
1x 1=1
9x 3=27
2x 1=2
-
5x 3=15
7x 1=7
8x 3=24
9x 1=9
6x 3=18
-
Sum:128
Next multiple of 10:
13 x 10
130
Check Digit:
130 - 128
2

See http://www.gs1-germany.de/internet/content/produkte/ean/identsysteme/pruefziffernlogik/index_ger.html


Container Number

Last digit is the check digit (0-9). To compute the check digit, iterate the four alphabetic (owner code/product group) characters, then the six numeric digits from left to right. Multiply by 1,2,4,8,...,512, respectively, then compute the sum. Characters are converted to numbers based on a table A=10, B=12, C=13, D=14, .... Z=38. Check digit is then set to the remainder mod 11 (0 for both remainder 0 and 10).

Example: Container number HDMU6105504 has check digit 4.

Character/
Digit
Value Multiplier Product
H18x 1=18
D14x 2=28
M24x 4=96
U32x 8=256
66x 16=96
11x 32=32
00x 64=0
55x 128=320
55x 256=1280
00x 512=0
Sum:2446
Next lower multiple of 11:
222 x 11
2442
Check Digit:
2446 - 2442
4

Back to main page. Back to software page.


 
This page was last changed on September 10th, 2006. © Matthias Gärtner 2006