VIN (chassis)
Vehicle identification numbers, structural and check-digit validation.
Validate
- JavaScript library
- Python library
- Go library4 cases fail
- Ruby library3 cases fail
- Rust library4 cases fail
- .NET library4 cases fail
- Erlang library
Validates a VIN (chassi): 17 characters in the three sections of Resolução CONTRAN nº 968/2022, art. 3º (WMI, VDS and VIS), each a digit or a letter other than I, O and Q. The check ignores case and surrounding whitespace.
- The Brazilian rule does not require a check digit, and many Brazilian-built VINs do not carry one, so by default the function does not check it:
9BWZZZ377VT004251is valid. 2.4.0 always required the North American check digit. options.checkDigit: trueadds the North American rules of 49 CFR 565.15: the 9th character must be the weighted modulus 11 check digit (0to9orX), and the 10th (model year) cannot beU,Zor0. Use it for a vehicle built for the United States or Canada, or to keep the 2.4.0 result.- The
I,OandQexclusion comes from ISO 3779:2009, not from the resolution: the resolution lists no forbidden character and leaves the engraving to ABNT NBR 6066:2022 (art. 5º). The regularization VINs of its Anexo II (WMIXXX) are written without those letters, so they pass. - A VIN has no printed grouping, so a space,
.,-or/inside it makes the value invalid. - A VIN whose characters are all the same is rejected.
- Only the ASCII letters and digits count. A non-ASCII letter that upper-cases into an ASCII one (
ß,ſ) is rejected. Until 2.4.0 these characters were folded into ASCII letters. options.checkDigitdefaults tofalse.
| Parameter | Type | Required |
|---|---|---|
value | string | yes |
options | IsValidVinOptions | no |
options.checkDigit | boolean | no |
| returns | boolean |
Check if a VIN (Vehicle Identification Number / chassi) is valid. By default it checks 17 characters in the three sections of Resolução CONTRAN nº 968/2022, art. 3º (the WMI, the VDS and the VIS), each a digit or a capital letter other than I, O and Q.
- The
I,OandQexclusion comes from ISO 3779, not from the resolution: it lists no forbidden character and refers the engraving to ABNT NBR 6066:2022 (art. 5º), a paid standard with no official free copy. The regularization VINs of its Anexo II (WMIXXX) are written without those letters, so they pass. - Options (
IsValidVinOptions):checkDigit: truealso enforces the North-American rules of 49 CFR 565.15, the check digit at position 9 and a model year code other thanU,Zor0at position 10. Use it for a VIN of a vehicle built for the United States or Canada. - Brazilian rules do not mandate the check digit, and many Brazilian-built VINs do not carry one. Up to 2.4.0 it was always enforced; pass
{ checkDigit: true }to keep that behaviour. - Case-insensitive and trims surrounding whitespace; a value of one repeated character is rejected. A VIN is printed as one unbroken run, so a space,
.,-or/among the characters is rejected instead of being stripped. Only the ASCII letters and digits count: a non-ASCII letter that upper cases into an ASCII one (ſ,ß) is rejected.
import { isValidVin } from '@brazilian-utils/brazilian-utils';
isValidVin('9BWZZZ377VT004251'); // true (Brazilian VIN, no check digit)
isValidVin('9BWZZZ377VT004251', { checkDigit: true }); // false (its 9th character is not the check digit)
isValidVin('1HGCM82633A004352', { checkDigit: true }); // true
isValidVin('1m8gdm9axkp042788', { checkDigit: true }); // true (check digit X, lowercase)
isValidVin('1HGCM82633A004353', { checkDigit: true }); // false (bad check digit)
isValidVin('00000000000000000'); // false (every character the same)
isValidVin('1HGCM8263IA004352'); // false (contains the excluded letter I)
isValidVin('1HGCM82633A00435'); // false (16 characters)
isValidVin('1HGCM 82633 A004352'); // false (a separator among the characters)Source: ISO 3779:2009, 49 CFR 565.15 and Resolução CONTRAN nº 968/2022.
Code: brazilian-utils/javascriptTry it with JavaScript isValidVin
Shared test cases (43) and the result in each library vin.isValid
Official sources
- iso.org/standard/52200.html
- ecfr.gov/current/title-49/…/section-565.15
- gov.br/transportes/pt-br/…/resolucao9682022.pdf
- vpic.nhtsa.dot.gov/api
See also RENAVAM
Last updated on
