VIN
A vehicle identification number has 17 characters, and the ninth is a check digit worked out from the other sixteen.
What a VIN is
Digits and capital letters without I, O and Q, so that nothing reads like 1 or 0. The ninth character is the check digit and the tenth is the model year. The rules on this page are the US ones, from the federal regulation 49 CFR 565, which also works an example through.
The check digit
- Give every character a value. A digit is worth itself. A letter is worth the number the regulation gives it: A and J are 1, B, K and S are 2, and so on up to 9.
- Multiply each value by the weight of its place: 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2. The ninth place weighs 0, so the check digit does not count towards itself.
- Add up the products and divide by 11. The remainder is the check digit, and a remainder of 10 is written X.
The regulation’s own example is 1G4AH59H45G118341. The products add up to 411, and 411 divided by 11 leaves 4, which is the ninth character.
Valid VINs for your tests
$ qadg quick vin --count 5 --seed example C4X8CFGR6T2U77911 KH3XW1VN6WH305386 K0GGU3FN0LCP28027 5HKZ4JYS8JX064237 F30TT603X4WT44749
Every VIN ends in five digits, as a passenger car’s must, and its tenth character is a model year code from the regulation. --count 1000 gives a thousand. A generated VIN can match a real vehicle, so keep it in test systems.
What your application should do with a broken one
Refuse a VIN whose ninth character does not match. Two things to know first. A vehicle built outside the reach of the US rules may carry a VIN with no check digit, and when the program reads a VIN it applies the US rule, so it counts such a VIN as broken. And a changed letter goes unnoticed when the new one has the same value, such as J in place of A, so the check digit cannot catch every typing mistake.
Broken ones for your tests
The recipe below makes 100 values and asks for damage in 20% of the rows. Download it and run it as it is, then change the count or the share to fit your tests.
The recipe
# VINs for testing, with one broken value asked for in about a fifth of the
# rows.
#
# Every VIN has a correct check digit in the ninth place and a model year in the
# tenth. A VIN can match a real vehicle, so keep the file in test systems. The
# damage changes a digit or swaps two, and the manifest says your application
# should reject each one. It also lists the damage this build could not carry
# out, with the reason.
#
# qadg generate vin.yaml
#
# writes vehicle.csv, expectation-manifest.json and run-note.json. The same seed
# breaks the same values on every machine.
version: "0.1"
seed: "vin"
locale: en-US
entities:
vehicle:
count: 100
fields:
vin: { generator: vin }
policy:
layers: [L3]
rows: 20%
per_row: exactly_one
output:
format: csv
Run it
Save the recipe, then run this in the same folder. This is what the program printed for it.
$ qadg generate vin.yaml vehicle: 100 rows, 1 column 1 table, 100 rows written 17 defects ordered, 5 applied, manifest in expectation-manifest.json 12 defects could not be applied, and the manifest carries the reason for each one 1 because the values in those rows did not suit them 2 because this run lacks something they need, and the manifest says what for each one 9 because this build has no implementation of them yet
What it damaged
The recipe ordered 17 defects, and this build applied the 5 below. The other 12 are in the manifest as not applied, each with its reason, and the run above counts them by reason.
L3.checksum.off_by_onerejectvehicle 7, column vin
FUJ68S024PTY67056 → FUJ68S024PTY67057
L3.checksum.transposed_digitsrejectvehicle 9, column vin
BUEEWK2P599885839 → BUEEWK2P599885389
L3.checksum.off_by_onerejectvehicle 43, column vin
Z4ZE1AF17DEL76727 → Z4ZE1AF17DEL76728
L3.checksum.transposed_digitsrejectvehicle 48, column vin
MWL2FBAA0CKU91295 → MWL2FBAA0CKU91259
L3.checksum.off_by_onerejectvehicle 89, column vin
HBGUKEX8288F04836 → HBGUKEX8288F04837
Sources
- 49 CFR 565, Vehicle Identification Number Requirements, eCFR as of 3 September 2026: § 565.13 for the characters, § 565.15 for the check digit and the model year, tables III to VII.