A test VIN is a 17-character Vehicle Identification Number with a valid structure and a correctly computed check digit that describes no real vehicle. This generator produces them with a regional manufacturer prefix, a model-year code in position 10 and the check digit in position 9, plus a fictional make, model and colour for display tests.
Automotive, insurance, fleet and marketplace software validates VINs before doing anything else with them. A VIN with a wrong check digit fails there, and the decoding, lookup and display code you meant to test never runs.
How to use it
- Choose a manufacturing region — North America (WMI starting 1–5), Europe (S–Z) or Asia (J–R) — or leave it on any.
- Set the oldest and newest model year, anywhere from 1981 to 2030.
- Keep compute a valid check digit on for positive tests. Turn it off to get VINs that fail validation, for testing your error path.
- Export the batch as JSON, CSV or SQL. The seed regenerates the same VINs.
What you can control
- Correct 17-character structure: WMI (1–3), vehicle descriptor (4–8), check digit (9), model year (10), plant (11) and serial (12–17).
- Region-correct first characters for North America, Europe and Asia.
- Model-year codes for any year from 1981 to 2030.
- A valid or deliberately invalid check digit.
- No I, O or Q anywhere, as the standard requires.
- An optional make, model and colour column.
How the VIN check digit works
Each character gets a value — digits are themselves, letters transliterate (A=1, B=2 … H=8, J=1 … R=9, S=2 … Z=9) — and each position gets a weight: 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2. Position 9 has weight 0 because it holds the answer.
For the classic example 1M8GDM9AXKP042788, the weighted products are 8, 28, 48, 35, 16, 12, 18, 10, 0, 18, 56, 0, 24, 10, 28, 24, 16. They add up to 351, and 351 mod 11 = 10. A remainder of 10 is written as X, which is exactly what sits in position 9.
const VALUES = { A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8, J: 1, K: 2, L: 3, M: 4,
N: 5, P: 7, R: 9, S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9 };
const WEIGHTS = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
function vinValid(vin) {
if (!/^[A-HJ-NPR-Z0-9]{17}$/.test(vin)) return false;
const sum = [...vin].reduce((acc, c, i) => acc + (/\d/.test(c) ? Number(c) : VALUES[c]) * WEIGHTS[i], 0);
const check = sum % 11 === 10 ? "X" : String(sum % 11);
return vin[8] === check;
}
Testing ideas
- Case and whitespace. Paste a VIN in lowercase and with a trailing space. Your field should normalise both before validating, not reject them.
- Forbidden letters. Swap one character for
OorIand confirm the validator rejects it, even though the check digit could otherwise pass. - Model-year ambiguity. Generate VINs for 1985 and 2015 — both use
Fin position 10 — and check that your decoder uses another signal, or asks. - Invalid check digit. Turn the check digit off and confirm users see a clear message rather than a failed lookup.
What this is not
A valid check digit is not a registered vehicle. These VINs do not appear in any manufacturer, registry or history database. Use them to test software, never to represent a real car.