CNPJ Generator
Generate valid Brazilian CNPJ in legacy (numeric) or the new alphanumeric format, planned for July 2026. Check digits calculated by the official modulo 11 algorithm. Free, in-browser, no sign-up.
Click Generate CNPJ to create a number
About this tool
Free online CNPJ generator for developers, QA engineers, and programming students. Supports both the legacy format — 14 numeric digits with check digits calculated by modulo 11 — and the new alphanumeric CNPJ, planned for July 2026, in which the first twelve positions (base and branch) can contain letters A–Z in addition to digits. The last two characters, the check digits, remain numeric. All generated CNPJs are mathematically valid and pass any format validation or business rule. The process runs entirely in the browser, with no sign-up and no connection to real companies.
Features
How the CNPJ Algorithm Works — Legacy and Alphanumeric
In the legacy CNPJ, the 14 digits are split into base (8 digits), branch (4 digits — 0001 for headquarters), and check digits (2 digits). The check digits are calculated by weighted sum with modulo 11 applied twice: each character is multiplied by a specific weight, the results are summed, divided by 11, and the remainder determines the check digit (0 if the remainder is less than 2, otherwise 11 minus the remainder). The alphanumeric CNPJ follows the same procedure, but the first twelve positions (base and branch) can include letters A–Z. For the calculation, each character receives its ASCII table value minus 48: digits from 0 to 9 keep their value, and letters become A=17, B=18, C=19, and so on through Z=42. The resulting check digits are always numeric (0–9). The Receita Federal recommends avoiding the letters I, O, Q, and F because they can cause visual confusion with numbers and collisions in the check-digit calculation; this generator already excludes them.
Legacy CNPJ vs. Alphanumeric CNPJ — What's the Difference?
The Brazilian CNPJ has undergone a structural update. The legacy format uses only digits across its 14 characters, and the numeric model is close to its registration limit. The new alphanumeric format, planned for July 2026, keeps the 14 characters, but the first twelve positions (base and branch) will accept letters A–Z in addition to digits, significantly expanding capacity for new registrations. Only the two check digits remain numeric, and the modulo 11 calculation does not change — simplifying the adaptation of existing systems.
Use Cases
The most common practical applications of the CNPJ generator in development and QA workflows are:
- Form and UI ValidationTest CNPJ fields, masks, and validation logic in registration forms. With the new alphanumeric format available, verify whether the UI correctly accepts letters in the first positions.
- Tax Systems and NF-eValidate invoice issuance flows and billing system integrations, testing both legacy and alphanumeric CNPJs.
- Databases and Staging EnvironmentsFill staging and testing environments with realistic company data without exposing real company information.
- API IntegrationRun integration tests with external services that validate CNPJ format, checking whether both legacy and alphanumeric formats are accepted.
- UX Design and DemosCreate business personas for Figma, Adobe XD prototypes, or client presentations without exposing real company data.
- Migration to Alphanumeric CNPJGenerate alphanumeric CNPJs to test whether legacy systems have been correctly updated: form fields accepting letters, database columns with correct type and length, API validations, and business rules.
- Cross-Format Compatibility TestingGenerate batches of both types to ensure reports, integrations, and business rules handle both formats consistently during the coexistence period.
How to Use
Choose the format
Select Legacy CNPJ (numeric, 14 digits) or Alphanumeric CNPJ (new format with letters in the first positions). When you open the page, a legacy CNPJ is already generated automatically.
Generate one or several
Click "Generate CNPJ" for a single number, ready to copy with one click. For batches, enable "Generate Multiple CNPJs", set the quantity (2 to 100), and use "Copy All".
Choose the output format
Enable "No punctuation" to remove dots, slash, and dash — ideal for databases, JSON, and APIs.
Questions & Answers
No. The generated CNPJs are fictitious and not registered with the Receita Federal. They pass mathematical check digit validation, but have no legal validity. Use exclusively for software testing and development.
Yes, for software testing, educational purposes, and technical demonstrations. Using fictitious or third-party CNPJs for official registrations, fraud, or obtaining undue benefits is a crime under the Brazilian Penal Code (Art. 299).
The alphanumeric CNPJ is the new format for the Brazilian company registry, planned for July 2026. The first twelve positions of the number (the 8-character base and the 4-character branch) will accept letters A–Z in addition to digits 0–9. The two check digits remain numeric, and the modulo 11 validation algorithm stays the same — only letter values are obtained from the ASCII table minus 48 (A=17 through Z=42).
The new alphanumeric CNPJ is planned for July 2026. The Receita Federal will adopt a gradual transition: legacy (numeric) CNPJs already issued will remain valid indefinitely, and new company registrations will start receiving the alphanumeric format as the numeric stock is exhausted. In practice, systems processing CNPJs need to be prepared to validate and store both formats.
Yes, all CNPJs issued in the legacy numeric format remain fully valid and do not need to be replaced. The shift to the alphanumeric format is additive: new registrations use the new format, but companies with a legacy CNPJ do not need to migrate. For developers, this means systems must accept and validate both formats simultaneously.
The CNPJ has 2 check digits calculated from the first 12 characters (base + branch) using weighted sum with modulo 11 applied twice. The weights for the first calculation are 5,4,3,2,9,8,7,6,5,4,3,2 and for the second 6,5,4,3,2,9,8,7,6,5,4,3,2. For alphanumeric CNPJs, letters are converted using their ASCII code minus 48 (A=17 through Z=42) before the same calculation. If the remainder is less than 2, the check digit is 0; otherwise it is 11 minus the remainder. The Receita Federal recommends avoiding the letters I, O, Q, and F.