CNPJ Generator
Generate valid CNPJ numbers for testing and software development. Generated CNPJs have mathematically correct check digits.
Related Tools
What is a CNPJ?
The CNPJ (Cadastro Nacional da Pessoa JurΓdica) is the unique registration number assigned by the Brazilian Federal Revenue Service to companies, associations, foundations and other legal entities. It works like a tax ID for businesses β it is the fiscal identity that allows legal operation in Brazil.
Every company that engages in economic activity in Brazil is required to have a CNPJ. It is necessary to open corporate bank accounts, issue invoices, participate in public bids, hire employees and perform various other commercial operations.
The CNPJ was created in 1998 to replace the CGC (General Taxpayer Registry) and is administered by the Special Secretariat of the Federal Revenue of Brazil, part of the Ministry of Economy.
CNPJ Structure
The traditional CNPJ consists of 14 numeric digits in the format XX.XXX.XXX/XXXX-XX. Each group of digits has a specific meaning:
The first 8 digits (root) identify the company. The next 4 digits (order) identify the headquarters (0001) or branches (0002, 0003, etc.). The last 2 digits are the check digits, calculated from the previous 12 using the modulo 11 algorithm.
For example, in CNPJ 11.222.333/0001-81, "11222333" is the company root, "0001" indicates it is the headquarters, and "81" are the check digits that confirm the number's validity.
How does the check digit calculation work?
CNPJ check digit calculation uses the modulo 11 algorithm. For the first digit, each of the first 12 numbers is multiplied by a specific weight from the sequence [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]. The sum of products is divided by 11 β if the remainder is less than 2, the digit is 0; otherwise, the digit is 11 minus the remainder.
The second digit is calculated similarly, but including the already calculated first check digit and using the weight sequence [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]. This double verification ensures that typing errors are easily detected.
This algorithm is the same one used by the Brazilian Federal Revenue to validate CNPJs and is widely implemented in software systems for registration data verification.
What is a CNPJ generator used for?
A CNPJ generator creates numbers with mathematically valid check digits, useful exclusively for testing and software development purposes. Generated CNPJs are NOT real registrations with the Federal Revenue and must not be used for any illegal or fraudulent purpose.
Developers use CNPJ generators to test form validations, simulate API integrations, populate test databases and verify that their systems correctly process the CNPJ format. It is an essential tool in the software development cycle.
Accountants and IT professionals also use CNPJ generators for educational purposes, such as demonstrating how the validation algorithm works in training courses.