< Vehicle Identification Numbers (VIN codes)

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 except in the United Kingdom where the check digit is not used.

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 process

An overview of the process for calculating a VIN's check digit is as follows:

  1. Remove all of the letters from the VIN by transliterating them with their numeric counterparts. Numerical counterparts can be found in the table below.
  2. Multiply this new number, the yield of the transliteration, with the assigned weight. Weights can be found in the table below.
  3. Sum the resulting products.
  4. Modulus the sum of the products by 11, to find the remainder.
  5. If the remainder is 10 replace it with X.

Transliterating the numbers

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.

Transliteration key: values for VIN Decoding4197279207
A: 1B: 2C: 3D: 4E: 5F: 6G: 7H: 8N/A
J: 1K: 2L: 3M: 4N: 5N/AP: 7N/AR: 9
S: 2T: 3U: 4V: 5W: 6X: 7Y: 8Z: 9

S is 2, and not 1. There is no left-alignment linearity.

Weights used in calculation

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.

Position 1234567891011121314151617
Weight 876543210098765432

Worked example

Consider the hypothetical VIN 1M8GDM9A_KP042788, where the underscore will be the check digit.

VIN 1M8GDM9A_KP042788
Value 14874491_27042788
Weight 876543210098765432
Products 8284835161218100185602410282416
  1. The VIN's Value is calculated from the above table, this number will be used in the rest of the calculation.
  2. Copy over the weights from the above table.
  3. The products row is a result of the multiplication of the vertical columns: Value and Weight.
  4. The products (8,28,48,35..24,16) are all added together to yield a sum of 351
  5. One of the following operations:
    • 351 % 11 = 10 (where % is a modulo operator)
    • 351 ÷ 11 = 31 10/11
    • 351 ÷ 11 = 31.9090-
  6. 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.

C# VIN validation Routine

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.