CNPJ Generator & Validator

Generate valid CNPJ numbers for software testing and validate any CNPJ instantly.

For software testing only. The data generated here is random and does not belong to any real person or company. Using it for fraud or in bad faith is a crime.

How to use

  1. Click "Generate" to create a random, mathematically valid CNPJ — with or without punctuation.
  2. To validate, paste any CNPJ in the validation field: both check digits are verified instantly, including the new alphanumeric format.
  3. Use "Copy" to grab the result. Everything runs in your browser — nothing is sent to any server.

About this tool

The CNPJ (Cadastro Nacional da Pessoa Jurídica) identifies companies in Brazil. It has 14 positions: an 8-position root that identifies the company, a 4-position suffix for the branch (0001 for the headquarters), and two check digits computed with the modulo 11 algorithm. This generator produces numbers that pass that validation, which is what a developer needs to test company registration forms, invoicing systems and ERP integrations.

Like the CPF generator, everything here is random: the generated CNPJ is not looked up in any registry and does not correspond to any real company. The tool guarantees only that the math checks out — enough for any correctly implemented validation to accept it in a test environment, and no more than that. Using generated documents outside of testing may constitute fraud.

The validator also understands the alphanumeric CNPJ, the format Brazil started issuing to new registrations in July 2026. In it, the 12 first positions may contain letters, and the check-digit math uses each character's ASCII value minus 48. The generator produces the classic all-numeric format, which remains valid and is what most test suites expect.

The formula

Check digits: multiply the first 12 positions by weights 5,4,3,2,9,8,7,6,5,4,3,2 and take the remainder of the division by 11; if the remainder is 0 or 1 the digit is 0, otherwise 11 minus the remainder. Repeat with weights 6,5,4,3,2,9,8,7,6,5,4,3,2 including the first check digit. For alphanumeric CNPJs, each character contributes its ASCII value minus 48.

Frequently asked questions

Is the generated CNPJ a real company?

No. It is a random number that only satisfies the check-digit math. It is not registered with the Receita Federal and does not belong to any company.

What do the parts of a CNPJ mean?

The first 8 positions identify the company (the "root"), the next 4 identify the branch — 0001 is the headquarters — and the last 2 are check digits.

What is the alphanumeric CNPJ?

Since July 2026 new Brazilian registrations can receive CNPJs with letters in the first 12 positions. The check-digit algorithm is the same, using each character's ASCII value minus 48. The validator here accepts both formats.

Can I use a generated CNPJ to issue invoices or open accounts?

No. Generated documents are for software testing only. Using them on real services may constitute fraud, which is a crime.

Does the CNPJ leave my browser?

No. Generation and validation run 100% in JavaScript on your device. Nothing is transmitted or stored.

Related tools

Long links? Shorten them for free

Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.

Vai.la is not responsible for how the tools are used or for decisions made based on their results.