Updated: July 2026
CNPJ Generator is a free online tool that creates CNPJ numbers with the two check digits correctly calculated by the official algorithm. It is made for those who need example data when programming, testing registrations and validating forms, without depending on real information from companies.
What is it
CNPJ is the National Register of Legal Entities, the number that identifies each company in Brazil. It has 14 digits and ends with two check digits, which act as a "real test" to check whether the number was entered without errors.
This generator assembles numbers that pass this mathematical validation, that is, they are structurally valid. The tool allows:
- Generate or Validate: Use the Generator tab to create new examples, or the Validator tab to check if a test CNPJ already exists and if your math is correct.
- Format the result with dots, slash and dash (00.000.000/0001-00) or leave just the numbers.
- Generate in batch, creating several CNPJs at once to populate test tables and spreadsheets.
- Choose head office or branch, adjusting the part of the number that indicates the company unit (the section 0001 for head office, or higher values for branches).
Important: the numbers created here are fictitious and do not belong to any company registered with the Federal Revenue Service. They are used exclusively for testing software. Using false data to impersonate another person or company, issuing documents or carrying out scams is a crime provided for by law. Use responsibly.
How to use
Generating or validating a CNPJ takes just a few seconds:
- Choose the tab: use Generator to create new numbers or Validator to check an existing CNPJ.
- Adjust the options: decide whether you want the formatted result (00,000,000/0001-00) or just the numbers, and choose head office or branch.
- Define the quantity: to generate in batch, enter how many CNPJs you need at once.
- Copy the result: click to copy and paste directly into your system, spreadsheet or test database.
How do we calculate check digits?
Validation of a CNPJ depends on two final digits, calculated using decreasing weights.
- We multiply the first 12 digits by a sequence of weights (from 5 to 2, and then from 9 to 2).
- We add up all the results.
- We divide the sum by 11. If the remainder of the division is less than 2, the first digit will be 0. Otherwise, it will be 11 minus the remainder.
- We repeat the logic with the 13 digits (including the first checker) and weights (6 to 2, and 9 to 2) to find the last digit.
Tips
- Always prefer these numbers in homologation databases, never in production.
- To test the validation of your system, generate a valid CNPJ and also an invalid one (e.g. change the last digit), and check the error messages.
- If your database separates headquarters and branch, generate CNPJs with root 0002+ to cover branch scenarios.