1001Ferramentas
📋 Generators

Batch CNPJ Generator

Generate multiple valid CNPJs at once (up to 1000) for software testing. With or without formatting.

What is batch CNPJ generation for?

It's there to fill test databases and check forms with hundreds of distinct CNPJs at once. You get up to 1,000 CNPJs, each with check digits worked out by modulo 11.

None of these CNPJs maps to a real company. They're numbers that merely pass the mathematical validation.

Keep their use to test environments.

Bulk CNPJ generation for testing and seeding

A bulk CNPJ generator outputs dozens or hundreds of mathematically valid Cadastro Nacional da Pessoa Jurídica numbers in one go — handy for integration tests against Receita Federal sandboxes, populating a CRM with fictitious suppliers, seeding e-invoice (NF-e) staging environments, or building factory fixtures that simulate a marketplace with many sellers.

Anatomy of a CNPJ

The CNPJ is fourteen digits long, written as XX.XXX.XXX/YYYY-DD:

  • 8 digits — the raiz (root), shared by every establishment of the same legal entity;
  • 4 digits — the establishment order: 0001 is the headquarters (matriz); 0002, 0003, … are branches (filiais);
  • 2 digits — check digits computed with the modulo-11 algorithm.

Two companies with different roots are unrelated; two CNPJs that share the same root belong to the same legal entity (e.g. a retail chain with one headquarters and dozens of stores).

Check-digit algorithm

For DV1, multiply each of the first twelve digits by the weights 5,4,3,2,9,8,7,6,5,4,3,2, sum the products, take the remainder modulo 11; the DV is 0 if the remainder is 0 or 1, otherwise it is 11 minus the remainder. For DV2, repeat across the first thirteen digits (now including DV1) with weights 6,5,4,3,2,9,8,7,6,5,4,3,2. The trailing two digits must match both computations.

Use cases

  • Integration tests against Sefaz sandboxes for NF-e, NFC-e or CT-e issuance.
  • Seeding a CRM, ERP or marketplace with fictitious suppliers, customers or sellers.
  • Building Faker / factory_bot / Bogus factories that produce realistic Brazilian B2B data.
  • Stress-testing CNPJ mask widgets and front-end validators.
  • Demonstrating reports, dashboards and BI dashboards without exposing real partners.

The alphanumeric CNPJ (July 2026)

In October 2024 the Receita Federal published Instrução Normativa RFB 2.229/2024, which introduces an alphanumeric CNPJ from July 2026. The first twelve positions will accept uppercase letters and digits (A-Z and 0-9); the last two remain numeric check digits. Existing numeric CNPJs stay valid indefinitely — only new registrations from that date receive the new format. The check-digit math is preserved by mapping each character to ord(c) - 48, so 0-9 stay themselves and A-Z become 17-42. This generator currently produces numeric CNPJs that are forward-compatible with the new algorithm.

FAQ

Will the tool produce a real company's CNPJ? No. The numbers are mathematically valid but are not registered with the Receita Federal. The probability of collision with a real CNPJ is non-zero (there are ~57 million issued), but the output should not be used as proof of existence — query the official consulta CNPJ service if you need to confirm a registration.

Are the check digits actually valid? Yes. Every CNPJ produced passes the standard modulo-11 verification used by Sefaz, banks and validation libraries.

Can I use these in a Sefaz sandbox? In general, yes — most homologation environments accept any algorithmically valid CNPJ. Some require a pre-registered taxpayer (a CNPJ tied to a digital certificate); check the specific UF's sandbox rules.

Is there a batch limit? 1,000 CNPJs per request, the same as the CPF tool.

Legal warning. Issuing an invoice, opening a bank account, signing a contract or claiming tax benefits with a generated CNPJ is fraud under Código Penal arts. 171 and 299.

Related Tools

Generate many valid CNPJs at once

Testing a B2B system with realistic volume calls for a pile of CNPJs, and creating each one by hand just can't keep up. Here you generate several in one shot, up to a thousand, all consistent with the check-digit calculation and matching no real companies.

Set the quantity and choose with or without the standard formatting, depending on what the system expects to receive. It's the quick way to put together test data for development, staging and load testing. Worth repeating the ethical line: fictitious numbers are for testing, never to simulate companies in real situations.

The numbers are all born in the browser, with no database lookup at all. Generate the whole list and take it over to your test environment in one go.