Free VIN Test Data

Valid and invalid VINs with the expected answer, for developers and testers

Test data, not real vehicles. Every VIN here is synthetic. The valid ones use real make and model patterns with made-up serial numbers and a calculated check digit. None belongs to a real car. Use them for tests, demos and learning only.

Download

Four files, free to use in your tests and software. The file names will not change, so you can fetch them from a script.

FileRowsWhat it holdsDownload
Valid VINs24010 for each of 24 makes, across models and years 2015 to 2026. 26 of them have an X check digitCSV · JSON
Invalid and edge cases195Wrong check digit (50), forbidden letters I, O, Q (40), wrong length (40), formatting problems (30), swapped neighbours (25), edge cases (10). Each row says what a strict validator should answerCSV · JSON

Columns

ColumnFileMeaning
vinbothThe VIN exactly as it should be fed to your code, including any stray spaces or quotes in the formatting rows
make, model, yearvalidThe pattern the VIN was built from
wmi, plant_letter, check_digitvalidCharacters 1 to 3, character 11 and character 9
categoryinvalidWhich kind of mistake the row tests
expected_validinvalidtrue or false: the answer of a strict validator that does no cleaning
noteinvalidWhat was done to the VIN

6 rows are marked expected_valid = true even though they sit in the edge-case file, for example 11111111111111111. They pass the check digit but are not real VINs. That is the point of them: passing the math does not make a VIN real. The formatting rows are marked false because a strict validator rejects the raw text, but each becomes valid once you strip the extra characters.

What to Test With It

  • Validation logic: run every row through your validator and compare with expected_valid.
  • Input cleaning: the formatting rows show what real users paste: lowercase, spaces, quotes, dashes, a trailing comma.
  • Error messages: each category needs its own message, such as "has 16 characters" or "contains the letter O".
  • Bulk import: load the 240 valid VINs into a spreadsheet or database table and check nothing is rejected.
  • The X check digit: 26 valid rows have an X in position 9. Code that only expects digits fails on these.

Code That Uses It

Both samples validate a VIN and then check it against the files. We ran them against these exact files: 240 of 240 valid rows pass, and all 195 invalid and edge-case rows give the expected answer. Put the sample next to the files and run it.

JavaScript (Node 18 or newer)

// Validate a VIN: 17 characters, no I, O or Q, and a matching check digit.
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 isValidVin(vin) {
  if (!/^[A-HJ-NPR-Z0-9]{17}$/.test(vin)) return false;
  let sum = 0;
  for (let i = 0; i < 17; i++) {
    const ch = vin[i];
    sum += (/\d/.test(ch) ? Number(ch) : VALUES[ch]) * WEIGHTS[i];
  }
  const check = sum % 11 === 10 ? 'X' : String(sum % 11);
  return vin[8] === check;
}

// Run it against the test files (Node 18 or newer).
const valid = require('./vin-test-valid.json');
const cases = require('./vin-test-invalid.json');
console.log('valid file:', valid.filter(v => isValidVin(v.vin)).length, 'of', valid.length, 'pass');
const wrong = cases.filter(c => isValidVin(c.vin) !== c.expected_valid);
console.log('invalid file:', cases.length - wrong.length, 'of', cases.length, 'give the expected answer');

Python 3

import csv

VALUES = {**{c: i for i, c in enumerate("ABCDEFGH", 1)}, **{c: i for i, c in enumerate("JKLMN", 1)},
          "P": 7, "R": 9, **{c: i for i, c in enumerate("STUVWXYZ", 2)}}
WEIGHTS = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2]
ALLOWED = set("ABCDEFGHJKLMNPRSTUVWXYZ0123456789")

def is_valid_vin(vin: str) -> bool:
    """17 characters, no I, O or Q, and a matching check digit."""
    if len(vin) != 17 or not set(vin) <= ALLOWED:
        return False
    total = sum((int(c) if c.isdigit() else VALUES[c]) * w for c, w in zip(vin, WEIGHTS))
    check = "X" if total % 11 == 10 else str(total % 11)
    return vin[8] == check

# Run it against the CSV files.
with open("vin-test-valid.csv", newline="", encoding="utf-8-sig") as f:
    rows = list(csv.DictReader(f))
print("valid file:", sum(is_valid_vin(r["vin"]) for r in rows), "of", len(rows), "pass")

with open("vin-test-invalid.csv", newline="", encoding="utf-8-sig") as f:
    rows = list(csv.DictReader(f))
right = sum(is_valid_vin(r["vin"]) == (r["expected_valid"] == "true") for r in rows)
print("invalid file:", right, "of", len(rows), "give the expected answer")

How We Built and Checked It

A script builds the files from the make and model patterns behind our VIN generator by make and model, with a fixed random seed so the result is repeatable. A second script then runs every row through the same validator code that powers our bulk VIN validator. All rows agree. More on our methods is on the How We Test page.

More Test Material

Found a problem in a file, or want another kind of test data? Tell us on the contact page.