One element that is fairly consistent in VIN numbers is the use of position 9 as a Check digit, compulsory for vehicles in North America and used fairly consistently even outside this rule.
If trying to validate a VIN with a check digit, first either: (a) remove the check digit for the purpose of calculation; or (b) utilize the multiplicative property of zero in the weight to cancel it out. You should later compare the old value of the check-bit, with the new to ensure the VIN's validity.
Overview of the processEdit
An overview of the process for calculating a VIN's check digit is as follows:
- Remove all of the letters from the VIN by transliterating them with their numeric counterparts. Numerical counterparts can be found in the table below.
- Multiply this new number, the yield of the transliteration, with the assigned weight. Weights can be found in the table below.
- Sum the resulting products.
- Modulus the sum of the products by 11, to find the remainder.
- If the remainder is 10 replace it with X.
Transliterating the numbersEdit
Transliteration consists of removing all of letters and substituting them with their appropriate numerical counterparts. These numerical alternatives can be found in the following chart. I, O and Q are not allowed, and can not exist in a valid VIN; for the purpose of this chart, they have been filled in with N/A (not applicable). Numerical digits use their own values.
|A: 1||B: 2||C: 3||D: 4||E: 5||F: 6||G: 7||H: 8||N/A|
|J: 1||K: 2||L: 3||M: 4||N: 5||N/A||P: 7||N/A||R: 9|
|S: 2||T: 3||U: 4||V: 5||W: 6||X: 7||Y: 8||Z: 9|
S is 2, and not 1. There is no left-alignment linearity.
Weights used in calculationEdit
The following is the weight factor for each position in the VIN. The 9th position is that of the check digit. It has been substituted with a 0, which will cancel it out in the multiplication step.
Consider the hypothetical VIN 1M8GDM9A_KP042788, where the underscore will be the check digit.
- The VIN's Value is calculated from the above table, this number will be used in the rest of the calculation.
- Copy over the weights from the above table.
- The products row is a result of the multiplication of the vertical columns: Value and Weight.
- The products (8,28,48,35..24,16) are all added together to yield a sum of 351
- One of the following operations:
- 351 % 11 = 10 (where % is a modulo operator)
- 351 ÷ 11 = 31 10/11
- 351 ÷ 11 = 31.9090-
- The check digit is 10, so it has been transliterated into X.
With a check digit of 'X' the VIN: 1M8GDM9A?KP042788 is written with the check bit as: 1M8GDM9AXKP042788.
Straight-ones (seventeen consecutive '1's) will suffice the check-digit. This is because a value of one, multiplied against 89 (sum of weights), is still 89. And 89 % 11 is 1, the check digit. This is an easy way to test a vin-check algorithm.
You can also generate VIN numbers with corrected check digit at VIN Generator