CNH Validator
Validate CNH numbers (National Driver's License) quickly and securely.
About the CNH Validator
This tool verifies the mathematical validity of a CNH (National Driver's License) number. The validation is based on the algorithms for calculating the two verification digits, which ensure the integrity and authenticity of the document's numeric sequence.
It is an essential tool for developers and testers (QAs) who need to ensure their systems correctly validate the CNH format. A mathematically valid CNH number will pass form validations, but this does not mean the CNH belongs to a real person or is registered with any DETRAN.
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.