VIN (chassis)

Vehicle identification numbers, structural and check-digit validation.

  • Parity matrix

Validate

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: 9BWZZZ377VT004251 is valid. 2.4.0 always required the North American check digit.
  • options.checkDigit: true adds the North American rules of 49 CFR 565.15: the 9th character must be the weighted modulus 11 check digit (0 to 9 or X), and the 10th (model year) cannot be U, Z or 0. Use it for a vehicle built for the United States or Canada, or to keep the 2.4.0 result.
  • The I, O and Q exclusion 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 (WMI XXX) 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.checkDigit defaults to false.
ParameterTypeRequired
valuestringyes
optionsIsValidVinOptionsno
options.checkDigitbooleanno
returnsboolean

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, O and Q exclusion 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 (WMI XXX) are written without those letters, so they pass.
  • Options (IsValidVinOptions): checkDigit: true also enforces the North-American rules of 49 CFR 565.15, the check digit at position 9 and a model year code other than U, Z or 0 at 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/javascript
Try it with JavaScript isValidVin
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (43) and the result in each library vin.isValid

Official sources

See also RENAVAM

Last updated on

On this page