Brazilian Driver's License (CNH) Validator
Type a CNH number and see right away whether both check digits match. If they do not, the tool shows what they should be.
Need a CNH number to test with?
What the validator checks
The registration number on a Brazilian driver's license (CNH) has 11 digits, and the last two are calculated from the first nine. This page redoes that calculation with what you typed and compares it with the check digits you entered.
The Brazilian Driver's License Number Generator uses the same rule, so everything it creates passes here. A number with all 11 digits the same, like 00000000000, is rejected even though the math works out.
How the number is built
The 11 digits split into two parts:
- Digits 1 to 9: the base of the registration number.
- Digits 10 and 11: the two check digits.
- The field accepts dots and a hyphen, but only the digits go into the calculation.
The tool checks the 11-digit registration number. The mirror number and the security code printed on the license are different numbers and are not part of this calculation.
How the check digits are calculated
The calculation uses Modulo 11 twice, always on the first 9 digits:
- Multiply the 9 digits by 9, 8, 7, 6, 5, 4, 3, 2 and 1, from left to right, and add the results.
- Divide the sum by 11. The remainder is the first digit. If the remainder is 10, the first digit is 0 and the second calculation subtracts 2.
- Multiply the same 9 digits by 1, 2, 3, 4, 5, 6, 7, 8 and 9 and add the results.
- Divide by 11 and subtract the 2 from the previous step from the remainder, if there is one. If the value goes negative, add 11. If it reaches 10 or more, the second digit is 0.
Example with 987654321: the first sum is 285 and the remainder is 10, so the first digit is 0 and the subtraction is 2. The second sum is 165 and the remainder is 0. After the subtraction the value is negative, and adding 11 gives 9 for the second digit. The CNH is 98765432109.
What it is for
- Testing a form's CNH field with numbers that pass and numbers that fail.
- Checking that a CNH generated for testing has the right digits.
- Finding typos, such as a swapped digit, in a list of registration numbers.
Frequently asked questions about the CNH Validator
What the CNH check covers and what it cannot tell you.