Generate valid Brazilian driver's license (CNH) numbers for software testing and validate any CNH instantly.
The CNH (Carteira Nacional de Habilitação) is the Brazilian driver's license. The number that identifies it — the registro — has 11 digits: nine that identify the document plus two check digits defined by DENATRAN and computed with two passes of modulo 11 arithmetic. This tool generates numbers that satisfy that math, and validates any number you paste against the same rule.
The second check digit has a quirk worth knowing if you are implementing the rule yourself. The first digit uses descending weights from 9 to 1; when its remainder reaches 10 the digit becomes 0 and a "discount" flag is raised. The second digit uses ascending weights from 1 to 9 and, when that flag is on, has 2 subtracted from it — wrapping back around 11 if the result goes negative — before the same 10-becomes-0 rule is applied. Implementations that skip the discount reject roughly one in eleven legitimate licenses, which is the usual reason two validators disagree about the same number.
Use it to populate test environments: driver registration forms, fleet management systems, ride-hailing onboarding and insurance quotes all ask for a CNH number, and any of them will reject a hand-typed sequence. The numbers here are random, drawn from your browser's cryptographic random source; they are not looked up in any Detran database and correspond to no real driver or license. Nothing is transmitted — generation and validation happen entirely on your device.
First check digit: multiply the 9 base digits by weights 9, 8, 7, 6, 5, 4, 3, 2, 1 and take the remainder of the division by 11; if it reaches 10 the digit is 0 and a discount of 2 is flagged. Second check digit: multiply the same 9 digits by weights 1, 2, 3, 4, 5, 6, 7, 8, 9, take the remainder of the division by 11, subtract the discount when it is flagged (adding 11 back if the result turns negative); if it reaches 10 the digit is 0.
No. The number is random and only satisfies the DENATRAN check-digit math. It is not registered with any Detran and does not belong to any driver.
The 11-digit número de registro, the field almost every system validates. The espelho number, the security code and the PID printed on the card are separate fields with no public check-digit rule.
Because many implementations skip the discount rule on the second check digit. When the first digit's remainder reaches 10, 2 must be subtracted from the second digit; validators that forget it wrongly reject about 9% of legitimate numbers.
Officially as 11 plain digits with no punctuation. The optional formatting here adds a hyphen before the two check digits purely to make the number easier to read and proofread.
No. Generated documents are for software testing only. Using them on real services may constitute fraud, which is a crime in Brazil.
No. Generation and validation run 100% in JavaScript on your device. Nothing is uploaded, logged or stored.
Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.
Vai.la is not responsible for how the tools are used or for decisions made based on their results.