Test data

Valid CNPJ generator

Generate mathematically valid CNPJ numbers in both formats — the familiar numeric one and the alphanumeric one in force since July 2026 —, validate any number and look up real companies in the Receita Federal registry.

  • 100% in the browser
  • free
  • no sign-up
Legal notice: the numbers generated here are fictitious and exist solely for software testing and development. They do not belong to real people or companies. Using fake documents for fraud, to sign up for services or for any unlawful purpose is a crime in Brazil (arts. 171 and 299 of the Penal Code).
CNPJ format

The generated documents show up here. Pick the options above and click “Generate”.

How to generate a valid CNPJ

Choose the format — numeric, the familiar one, or alphanumeric, the standard the Receita Federal has issued since July 2026 —, set how many you want (from 1 to 1000) and whether the output is formatted. The tool assembles the root, the establishment order and computes both check digits by Modulo 11, so every CNPJ generated passes validation in any system. Copy the whole batch at once or download it as JSON, CSV and SQL INSERT statements with the table name you prefer.

Generation happens entirely in your browser — no document is sent to or stored on CodeCrush servers.

The anatomy of a CNPJ

Take 11.222.333/0001-81. It is not a single block of fourteen characters: it is three parts with different jobs, and confusing them is the source of a good share of the bugs in corporate customer records.

The three parts that make up a CNPJ number and what each one means
PartExampleWhat it is
Root (8 positions)11.222.333Identifies the company. Head office and branches share exactly the same root.
Order (4 positions)00010001 is always the head office; 0002, 0003 and onwards are the other establishments.
Check digits (2)81Computed by Modulo 11 over the previous 12 positions. Always numeric.

A customer with ten stores has ten CNPJs that differ only in the order. If your system treats the CNPJ as the customer key, it will duplicate that company — or refuse the second store.

The alphanumeric CNPJ: what changed in 2026

Under Joint Technical Note COCAD/SUARA/RFB nº 49/2024, CNPJs issued from July 2026 onwards accept letters in the first 12 positions — something like 12.ABC.345/01DE-35. Only the two check digits stay numeric, and in the calculation each letter is worth its ASCII code minus 48 (A=17, B=18, up to Z=42). Older CNPJs do not change: both formats coexist indefinitely, so your system has to accept either.

In practice three things break — and testing them is exactly why the generator offers the new format:

  • Digits-only regex validation (/^\d{14}$/) starts rejecting legitimate documents;
  • Database columns declared as NUMERIC or BIGINT cannot hold letters and need to become VARCHAR(14);
  • Routines that cast the CNPJ to a number — to sort, compare or index — silently lose information.

Generate a few alphanumeric CNPJs here, drop them into your form and your API, and within minutes you will find where the code assumes digits — before a real customer shows up with a CNPJ containing letters.

Looking up a real CNPJ

The generated numbers are fictional: they belong to no company and must not be used with any real service. When you need data on a company that exists, the Look up a CNPJ tab returns the legal and trade names, registration status, business activity (CNAE), address and ownership from public Receita Federal data, served by BrasilAPI — an open-source project maintained by the Brazilian community. The request goes straight from your browser, with no API key and no sign-up.

Need a CPF as well?

Use the CPF generator, which produces valid documents and lets you pick the issuing state. And to generate CPF and CNPJ in bulk on one screen, with full fictional records and SQL export, the combined version handles both at once.

## faq

Frequently asked questions

How do I generate a valid CNPJ?

Pick the format (traditional numeric or alphanumeric, the new 2026 standard), how many you want and whether the output is formatted, then click Generate. The tool assembles the root, the branch order and calculates both check digits with the Receita Federal Modulo 11 algorithm, so every CNPJ generated passes validation in any system. It all happens in your browser — nothing is sent to a server.

Does the generated CNPJ belong to a real company?

No. The number is drawn at random and only satisfies the check-digit rule; it is never looked up in or registered with the Receita Federal database. If you need data on a company that actually exists, use the Look up tab: it fetches trade name, registration status, business activity (CNAE), address and ownership for a real CNPJ from public Receita Federal data.

What is the alphanumeric CNPJ and when did it start?

It is the new format defined by Joint Technical Note COCAD/SUARA/RFB nº 49/2024. Since July 2026 the Receita Federal issues CNPJs whose first 12 positions accept both letters and digits — as in 12.ABC.345/01DE-35 — while the two check digits remain numeric. Existing CNPJs do not change: the old and new formats coexist indefinitely.

What breaks in my system with the alphanumeric CNPJ?

Three things, in practice: masks and digits-only regexes (something like /^\d{14}$/) start rejecting legitimate documents; database columns declared as NUMERIC or BIGINT cannot hold letters and need to become VARCHAR(14); and routines that cast the CNPJ to a number silently lose information. Generating alphanumeric CNPJs here and feeding them into your sign-up flow is the fastest way to find where the code assumes digits.

How is the CNPJ check digit calculated?

The first 12 characters are multiplied by the weights 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3 and 2; the sum is divided by 11 and, if the remainder is less than 2, the digit is 0 — otherwise it is 11 minus the remainder. The second digit repeats the calculation over 13 positions with weights from 6 down to 2. In the alphanumeric format each letter enters the maths as its ASCII code minus 48 (A=17, B=18, up to Z=42). The Validate tab shows every multiplication for the number you type.

What do the digits after the slash, such as /0001, mean?

A CNPJ has three parts: the root (first 8 positions) identifies the company; the order after the slash (4 positions) identifies the establishment — 0001 is always the head office, and 0002, 0003 and so on are branches; the last 2 are the check digits. A company with several units shares the same root and only changes the order, which is a common source of bugs in systems that assume one CNPJ per customer.

Where does the CNPJ lookup data come from?

From BrasilAPI (brasilapi.com.br), a free open-source project that serves the public Receita Federal CNPJ registry. The request goes straight from your browser to BrasilAPI, with no API key and without passing through CodeCrush servers. Because the database is public, the lookup is free and requires no sign-up.

Can I generate many CNPJs at once and export them?

Yes. You can generate from 1 to 1000 CNPJs in one go and copy the result or download it as JSON, CSV or SQL INSERT statements with the table name of your choice. It is the most direct way to seed a staging database with a fictional portfolio of corporate customers — including a mix of numeric and alphanumeric CNPJs to exercise both formats.

## other tools