CNPJ Generator & Validator
Generate and validate Brazilian company IDs (CNPJ), including the new alphanumeric format (from July 2026).
The link keeps what is on screen.
Fictitious data generated by algorithm, valid only in format. Use for testing only — never to impersonate a person or company.
Result
Validate
How is it calculated?
The first 12 characters (root + branch) accept letters and digits; each is worth its ASCII code − 48. The 2 check digits use weights 5→2 and 9→2 (modulo 11), just like the numeric CNPJ.
See the code ↗Processed in your browser; nothing is sent.
Use from the terminal (JSON)
This tool also runs outside the site: the cli.js script uses the same logic as this page and returns the result as JSON. Parameters are the same as this page's URL — copy the command below with the values on screen.
Deno
deno run -q "https://tools.thecodecodex.com/cli.js?tool=cnpj"
Node.js / Bun
curl -s https://tools.thecodecodex.com/cli.js | node --input-type=module - cnpj q=…
| Parameter | Description | Default |
|---|---|---|
| q | quantidade (1-50) | 1 |
| kind | numeric | alphanumeric | numeric |
| mask | 1 = com máscara | 1 |
| v | CNPJ para validar | — |
Requires Deno, Node.js or Bun. With Deno the script runs with no permissions: it cannot read files or access the network. Central Bank indicators are from the day the site was published.
More in Brazil Documents
- CPF Generator & ValidatorGenerate valid Brazilian CPF numbers for testing (by state) and validate or format existing ones.
- NF-e Key & Boleto InspectorInspect, validate, and generate 44-digit Brazilian NF-e/CT-e access keys and decode 47-digit FEBRABAN bank slip lines.
- PIS, CNH, Voter ID & RENAVAMGenerate and validate Brazilian PIS/PASEP, Driver License (CNH), Voter ID (by state), and vehicle RENAVAM numbers for QA testing.