Axon Toolbox

Free telecom & identity tools

Free tool

Brazil CNPJ Generator & Validator

Generate valid test CNPJ numbers (Cadastro Nacional da Pessoa Jurídica) for companies — classic numeric or the alphanumeric format issued from July 2026 — or paste a CNPJ to check its branch and Receita Federal check digits.

CNPJ Generator

Pick the format and whether you want head-office numbers. The root is random; both check digits are calculated with Receita Federal's modulo-11 formula.

Flag of Brazil

Brazil · 14 characters

Alphanumeric roots are issued from July 2026

The four-character branch number

1 – 100

CNPJ Validator

Paste a 14-character CNPJ, with or without punctuation, numeric or alphanumeric, to check its branch and check digits.

Every CNPJ this tool produces is synthetic test data only. It is not registered with Receita Federal and does not belong to any real company. Use it on your own test systems only — never on a real invoice, registration or KYC check.

How a CNPJ number is structured

A CNPJ is fourteen characters: an eight-character root for the legal entity, a four-character branch number, and two check digits. Taking 11.222.333/0001-81 as an example:

The segments of a 14-character Brazilian CNPJ
DigitsSegmentMeaning
11222333Root (raiz)Identifies the legal entity. Digits only until July 2026; digits or letters A–Z after.
0001Branch (ordem)0001 is the head office (matriz); 0002 onwards are branches (filiais).
81Check digitsTwo digits, each a weighted-sum checksum modulo 11 over the characters before it.

The first check digit uses the weights 5 4 3 2 9 8 7 6 5 4 3 2 over the twelve root and branch characters; the second uses 6 5 4 3 2 9 8 7 6 5 4 3 2 over those twelve plus the first check digit. In each case the remainder of the sum divided by 11 gives the digit: a remainder of 0 or 1 means 0, anything else means 11 minus the remainder.

For an alphanumeric CNPJ each character is first converted to a number by subtracting 48 from its ASCII code — so the digits keep their own value and A through Z become 17 through 42 — and the same weights and remainders apply. The two check digits are always digits.

Why generate test CNPJs?

Any system that deals with Brazilian businesses stores CNPJs — supplier and merchant onboarding, electronic invoicing (NF-e), B2B KYC and sanctions screening, payment and payroll integrations. All of them need realistic input to test against.

Using a real company's CNPJ in a test environment is bad practice and, where it is joined to personal data of directors or staff, a privacy problem under LGPD. Synthetic numbers let you exercise format checks, branch handling and checksum validation without any real registry data leaving production — and generating alphanumeric ones now tells you whether your validation code will survive the July 2026 change before a real one reaches it.

Frequently asked questions

What is a CNPJ?
CNPJ (Cadastro Nacional da Pessoa Jurídica) is the registry number Receita Federal issues to every legal entity in Brazil — companies, branches, associations, funds and public bodies. It is required for invoicing, tax filing, opening business bank accounts and almost every B2B transaction.
How is a CNPJ structured?
Fourteen characters in three parts: an eight-character root that identifies the legal entity, a four-character branch number (0001 is the head office, 0002 onwards are branches), and two check digits calculated with a weighted modulo-11 formula over the twelve characters before them.
What is the alphanumeric CNPJ?
From July 2026 Receita Federal issues CNPJs whose root and branch positions can contain the letters A–Z as well as digits, because the numeric space was running out. Existing numeric CNPJs stay valid and unchanged. The check-digit formula is the same, except each letter is converted to a number first (its ASCII code minus 48, so A is 17 and Z is 42). This tool generates and validates both forms.
Is a CNPJ the same as a CPF?
No. A CPF is the 11-digit number for an individual person; a CNPJ is the 14-character number for a legal entity. They use different check-digit weights and cannot be interchanged.
Why does the validator reject 11.111.111/1111-11?
Repdigit numbers happen to satisfy the checksum formula, so real validators reject them by rule — including Receita Federal's own. This tool rejects them and never generates one.
Are these real CNPJs?
No. Every CNPJ this tool produces is randomly generated test data that is structurally valid and passes the checksum. The numbers are not registered with Receita Federal and do not belong to any real company. Never use them to impersonate a business or on a real invoice.
Why would I need generated CNPJs?
To test supplier onboarding, invoicing (NF-e), B2B KYC and payment flows in Brazil without using a real company's registry number. Synthetic numbers exercise the same format, branch and checksum logic while keeping real business data out of test systems — and the alphanumeric option lets you check your software is ready for the new format before real ones appear in production.