CNH Generator
Generate valid CNH numbers and development. Ideal for integration testing.
Waiting for generation...
About the CNH Generator
The Box4Dev CNH Generator creates structurally valid National Driver's License numbers. Each generated number follows the complex verification digit calculation algorithm (module 11) defined by DENATRAN.
This tool is essential for developers and testers who need valid CNH numbers to test registrations, car rental systems, transport applications, and any software that collects driver's license data.
Anatomy & Structure of Brazilian Driver's License
The CNH consists of 11 decimal digits in 2 segments:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 to 9 | Renach Registration | 9 digits | Sequential citizen driver registry record number | 027877543 |
| 10 & 11 | Check Digits | 2 digits | Dual check digits computed under Denatran Ordinance 185/2006 rules | 02 |
Official CNH Algorithm (Denatran Ordinance 185/2006)
Denatran specifies two weighted sums and a decrement factor when CD1 reaches remainder 10:
CD1 = (Sum1 % 11); if CD1 > 9 -> {CD1 = 0; dec = 2}; CD2 = (Sum2 % 11 - dec)
- 1. Multiply first 9 digits by descending weights 9 to 1.
- 2. Compute remainder modulo 11.
- 3. If remainder > 9, CD1 is 0 and decrement factor is 2; else CD1 equals remainder and decrement is 0.
- 4. For CD2, multiply first 9 digits by ascending weights 1 to 9.
- 5. Compute remainder modulo 11 and subtract decrement factor.
- 6. If CD2 < 0, add 11; if CD2 > 9, set CD2 to 0.
- 7. Sequences of 11 repeated digits are rejected.