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.
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:
| Digits | Segment | Meaning |
|---|---|---|
| 11222333 | Root (raiz) | Identifies the legal entity. Digits only until July 2026; digits or letters A–Z after. |
| 0001 | Branch (ordem) | 0001 is the head office (matriz); 0002 onwards are branches (filiais). |
| 81 | Check digits | Two 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.
