Skip to main content

CNPJ Generator

Generate valid CNPJ numbers and development. Excellent for your tests.

Waiting for generation...

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:

PositionFieldLengthMeaning & RuleExample
1 to 8Company Base Root8 digitsUnique nationwide legal entity registration root12345678
9 to 12Establishment Order4 digitsIdentifies headquarters (0001) or branch establishment (0002 to 9999)0001
13 & 14Check Digits2 digitsDual Modulo 11 check digits calculated with RFB cyclic weights95

Official CNPJ Checksum Algorithm (Brazilian Federal Revenue Modulo 11)

CNPJ integrity is verified with cyclic weights 2 to 9 across two Modulo 11 operations:

CD1 = (Sum1 % 11 < 2 ? 0 : 11 - Rem1); CD2 = (Sum2 % 11 < 2 ? 0 : 11 - Rem2)
  1. 1. Multiply first 12 digits by weights [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].
  2. 2. Sum all products and take remainder modulo 11.
  3. 3. If remainder < 2, CD1 is 0; otherwise CD1 = 11 - remainder.
  4. 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. 5. If remainder < 2, CD2 is 0; otherwise CD2 = 11 - remainder.
  6. 6. Sequences of 14 repeated digits are rejected.

Frequently Asked Questions (FAQ)