Test data for Brazilian software
EN
Fictitious data for software testing. Using fake documents for fraud is a crime in Brazil (Penal Code, arts. 297–299, 307).

CNH generator and validator

The CNH (Carteira Nacional de Habilitação) is Brazil’s national driver’s license. Generate fictitious 11-digit CNH registration numbers with computed check digits to test driver sign-up flows, mobility apps and fleet systems without real personal data.

—

Up to 1000 items at once. Everything is generated in your browser.

How to use

  1. On the generator tab, click Generate. The number comes as 11 plain digits, the way it is printed on the license.
  2. Click Copy to put it on your clipboard.
  3. To fill a test database, set the Quantity (1–1000) and use Export CSV or Export JSON.
  4. On the Validate tab, paste one or many numbers, one per line. Dots, hyphens and spaces are ignored.
  5. Each line is marked valid or shows why it failed: wrong length, invalid characters, repeated digits or wrong check digit.

How it works

The CNH registration number

Every Brazilian driver’s license carries a national registration number created in RENACH, the national driver registry run by SENATRAN (the federal traffic secretariat) and fed by the state DETRANs. It has 11 digits: 9 base digits and 2 check digits. It is not the same as the form (“espelho”) number or the driver’s CPF.

No official formula is published

Unlike CPF and CNPJ, we could not find any public SENATRAN or CONTRAN regulation describing how the check digits are computed. The rule below is the one widely adopted by open-source validators and industry systems, and it is exactly what this tool implements. Treat a pass as a format check, not official confirmation.

  1. First digit: multiply the 9 base digits by the weights 9, 8, 7, 6, 5, 4, 3, 2, 1, add them and take the remainder modulo 11. If the remainder is 10, the first digit becomes 0 and a discount of 2 applies to the next step.
  2. Second digit: multiply the same 9 digits by the weights 1, 2, 3, 4, 5, 6, 7, 8, 9, add, take the remainder modulo 11 and subtract the discount (0 or 2). If negative, add 11; if the result is 10, the digit is 0.

Note that the second digit does not use the first one as input, only the discount. The generator also skips bases made of one repeated digit and bases starting with zero.

Worked example: 284719356-??

First digit: 2×9 + 8×8 + 4×7 + 7×6 + 1×5 + 9×4 + 3×3 + 5×2 + 6×1 = 18 + 64 + 28 + 42 + 5 + 36 + 9 + 10 + 6 = 218. 218 mod 11 = 9, so the first digit is 9 and there is no discount.

Second digit: 2×1 + 8×2 + 4×3 + 7×4 + 1×5 + 9×6 + 3×7 + 5×8 + 6×9 = 2 + 16 + 12 + 28 + 5 + 54 + 21 + 40 + 54 = 232. 232 mod 11 = 1; 1 − 0 = 1.

Result: 28471935691.

FAQ

Does a valid result mean the license exists?

No. The tool only checks length, characters, repeated digits and the two check digits using the rule above. Whether a license exists, is current or is suspended can only be confirmed in official DETRAN and SENATRAN systems, which this tool does not query.

Why do you say there is no official formula?

Because we could not locate any public resolution or manual that publishes the CNH check-digit calculation. The rule is widely adopted, but it was documented by the developer community, not by an official body. If your project needs legal certainty, confirm with the traffic authority.

Are the registration number, form number and CPF the same?

No. The registration number is the driver’s national RENACH identifier and stays the same across renewals. The form number identifies the printed document and changes with each issue. The CPF is the tax ID. This tool handles only the registration number.

Can I use these numbers for real sign-ups?

No. They are fictitious and meant for automated tests, staging environments, demos and fixtures. Using them to pose as a licensed driver or to get around verification on real services is improper and may amount to fraud.

Is there a standard mask for CNH numbers?

No. The license shows the 11 digits without punctuation, which is why the generator has no mask option. The validator still accepts input containing dots, hyphens or spaces and evaluates only the digits.

Sources

Related tools

Updated 2026-11-13 · Rafael Lima