CNPJ Generator
Generate valid CNPJ numbers and development. Excellent for your tests.
About the CNPJ Generator
The Box4Dev CNPJ Generator is an online tool developed to create National Registry of Legal Entities numbers that are mathematically valid. Each generated CNPJ follows the standard Federal Revenue algorithm for calculating verification digits, ensuring its structural validity.
This resource is indispensable for developers, software testers, and systems analysts who need fictitious data to validate forms, test company registration logic, and ensure data integrity in development environments without using real company information.
Anatomy & Structure of Brazilian CNPJ
The National Registry of Legal Entities (CNPJ) comprises 14 decimal digits in 3 segments:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 to 8 | Company Base Root | 8 digits | Unique nationwide legal entity registration root | 12345678 |
| 9 to 12 | Establishment Order | 4 digits | Identifies headquarters (0001) or branch establishment (0002 to 9999) | 0001 |
| 13 & 14 | Check Digits | 2 digits | Dual Modulo 11 check digits calculated with RFB cyclic weights | 95 |
Official CNPJ Checksum Algorithm (Brazilian Federal Revenue Modulo 11)
CNPJ integrity is verified with cyclic weights 2 to 9 across two Modulo 11 operations:
- 1. Multiply first 12 digits by weights [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].
- 2. Sum all products and take remainder modulo 11.
- 3. If remainder < 2, CD1 is 0; otherwise CD1 = 11 - remainder.
- 4. For CD2, multiply first 12 digits by weights [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] and CD1 by 2.
- 5. If remainder < 2, CD2 is 0; otherwise CD2 = 11 - remainder.
- 6. Sequences of 14 repeated digits are rejected.