CNPJ generator for tests
The CNPJ is the Brazilian company tax number. It has 14 positions: eight for the root (the company), four for the establishment (0001 is the head office, 0002 onwards are branches) and two check digits. This generator creates CNPJs that are valid by the algorithm, for filling supplier forms, testing electronic invoice (NF-e) flows in a sandbox, or seeding a development database of an app that serves Brazilian businesses.
The numbers are for testing only: they pass the check digit calculation, but they are not registered with the Receita Federal and belong to no company. They cannot issue a real invoice, open an account or sign a contract, and using a fake CNPJ to deceive anyone may be a crime in Brazil.
The tool also generates the alphanumeric CNPJ that the Receita Federal has been assigning to new registrations since July 2026 (Normative Instruction RFB 2,229/2024). Its first 12 positions may hold uppercase letters as well as digits; the two check digits are still numbers. Existing CNPJs do not change. Everything runs in your browser and nothing is sent to a server.
How to generate a CNPJ
- Open the page: the country is Brazil (BR) and the document CNPJ (company tax ID), which generates numeric head-office numbers (
/0001). - To test the new format, switch the document to CNPJ alphanumeric (from Jul 2026).
- Choose How many (1, 5, 10 or 50) and whether you want With mask:
11.222.333/0001-81or11222333000181. - Use Copy, Copy all or Generate again.
- To check CNPJs you already have, paste them into the Validate box, one per line. Validation accepts both formats, in upper or lower case.
Examples
Check digits of 11.222.333/0001
Weights 5,4,3,2,9,8,7,6,5,4,3,2 over the 12 positions give a sum of 102; 102 mod 11 = 3, so the first check digit is 11 − 3 = 8. Weights 6,5,4,3,2,9,8,7,6,5,4,3,2 over the 13 positions give 120; 120 mod 11 = 10, so the second is 1. Result: 11.222.333/0001-81.
Head office and branch
Head office: 11.222.333/0001-81
Branch: 11.222.333/0002-62The root stays the same; the establishment number changes, and so do the check digits.
Alphanumeric CNPJ
Each character is worth its ASCII code minus 48: digits are 0 to 9 and letters go from A = 17 to Z = 42. The rest of the calculation is unchanged.
| Base (12 positions) | Full CNPJ |
|---|---|
| 12ABC34501DE | 12.ABC.345/01DE-35 |
| AB1CD2EF0001 | AB.1CD.2EF/0001-70 |
| 9X7Y5Z3W0001 | 9X.7Y5.Z3W/0001-07 |
Common errors
- "wrong format": there is a letter in one of the last two positions, as in
11.222.333/0001-8A. Check digits are always numbers. - "needs 14 characters": a position is missing or extra. Make sure a spreadsheet did not drop a leading zero.
- My system rejects the alphanumeric CNPJ: the column or the validation still accepts digits only. Store it as 14-character text and validate with the new algorithm, which also accepts the old numeric CNPJs.
Frequently asked questions
Does a generated CNPJ exist at the Receita Federal?
No. It only follows the check digit rule; an official lookup will not find it.
When did the CNPJ start to include letters?
New registrations have received alphanumeric CNPJs since July 2026. Older numeric CNPJs remain valid and are not replaced.
I also need a test CPF. Where do I get one?
Use the CPF generator, and the CPF validator to check a list. ID numbers from other countries are in test documents.