Freight Container Check Digit Calculator  

 
  
 
This page is to help lost souls searching for the algorithm for calculating the last digit (check digit) of the Identification Number of Ocean Ship Containers (according to ISO 6346).

After reading through everything on that topic that showed up on Google and Google-groups (spending several hairpulling days) we were unable to determine how exactly to compute the last digit (CRC?) of the 11 digit (actually alphanumeric) number.

All available information on the subject was several commercial products that can calculate it for you (and want money), one algorithm that was incorrect (almost random hits) and a lot of sites that decided that the algorithm is too complicated to be worth mentioning (or attempting).

We wrote a program in java swing which will clarify this mysterious algorithm - source code is available as well as demo.

Algorithm:
  • take the first 10 characters of the ID number and map* the letters to numbers;
  • multiply each resulting number with a weighing factor of 20 to 29 ;
  • sum all values;
  • divide sum by 11;   (11 digits  hence => mod11)
  • the remainder is the checkdigit we've all been looking for**;


A 10
H 18  
O 26
V 34  
B 12
I 19
P 27
W 35
C 13
J 20
Q 28
X 36  
D 14
K 21
R 29
Y 37
E 15
L 23
S 30
Z 38  
F 16
M 24
T 31  

G 17
N 25
U 32


note* - above is the map  (11, 22 and 33 are multiples of the modulus)


note** - 10 is also a possible remainder when we divide by 11 and it must be replaced by 0 although it is recommended that it is not used at all.
Exemple :

Z   E   P   U   0   0   3   7   2   5

maps to :
38  15  27  32  0   0   3   7   2   5

multiply by:
  1   2   4   8   16  32  64  128 256 512

we get:
   38  30  108 256 0   0   192 896 512 2560

add up:
4592
reminder mod 11:
4592 mod 11  = 5

Check digit is 5.

source code:
CheckDigitApplet.java   - the JApplet above
ContCheckDigit.java  -static function that does the algorithm
CheckDigitCalculator.java   - swing application
LimitDocument.java  
AllCapsLimitDocument.java


Feel free to use it as you please - we are not responsible for any harm caused by its use.
(program was written in Netbeans so contact us if you need the .form file)

 
 
 

Questions or comments? Get in touch with us at:


checkdigit@hotmail.com




[an error occurred while processing this directive]