Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 1.03 KB

README.md

File metadata and controls

19 lines (12 loc) · 1.03 KB

Vin.js

Verify a VIN's correctness by validating it's check digit.

Code taken from a StackOverflow answer I wrote in 2010 via the Wikipedia article on VIN Check digit calculation.

Usage

Vin.isValid("11111111111111111") // => true

Known Caveats

  • NHTSA standardized the format in 1981, so validation for older vehicles is not guaranteed.
  • Check digit validation is not compulsory for cars not destined for the North American market, and does not apply to all vehicles. Exceptions may include: Citroën, BMW, Renault, Audi, Korean Chevrolets, Fiat and European Fords, among others. See the above Wikipedia article for more info.
  • The following VIN, a 2012 Subaru Impreza 2.0i Premium, for example, does not validate correctly: JF1GPAC6XCH210522