CPF/CNPJ Generator and Validator
Generate valid CPF and CNPJ numbers (with correct check digits) and validate documents.
Generate valid CPF and CNPJ numbers (with correct check digits) and validate documents.
The CPF (Cadastro de Pessoas Físicas) is Brazil's individual taxpayer identification document, issued by the Receita Federal (Brazil's federal revenue service). It has 11 digits, the last 2 of which are check digits calculated from the first 9 using a modulo-11 algorithm, which detects typing errors and prevents simple fictitious documents from being accepted.
The CNPJ (Cadastro Nacional da Pessoa Jurídica) identifies companies and entities in Brazil. In the traditional (numeric) format, it has 14 digits — 12 base digits and 2 check digits. It follows the same modulo-11 principle as the CPF, with specific weights for each position.
Starting in 2026, Brazil's Receita Federal began issuing CNPJs in the alphanumeric format: the 12 base characters can be digits (0–9) or uppercase letters (A–Z), while the final 2 check digits remain always numeric. This significantly expands the capacity to register new companies.
When calculating the check digits of the alphanumeric CNPJ, each character is converted to a numeric value by subtracting 48 from its ASCII code: so '0'–'9' become 0–9 and 'A'–'Z' become 17–42. The same weights used for the numeric CNPJ are applied to these values, and the modulo-11 rule is identical.
This tool supports generation and validation of both formats.
No. The CPFs and CNPJs generated by this tool are fictitious — mathematically valid (they pass the check-digit verification), but they do not belong to any person or company registered with the Receita Federal. They are useful only for software testing, filling development forms and validating systems.
They are the last digits of a CPF or CNPJ, calculated mathematically from the preceding digits. Any typing error in one of the preceding digits (except for rare coincidences) makes the check digits incorrect, allowing systems to detect invalid documents even before consulting the Receita Federal.
Sequences like 000.000.000-00, 111.111.111-11, … 999.999.999-99 pass the check-digit calculation mathematically, but are officially rejected by the Receita Federal for being obviously fictitious. This tool rejects them during validation and never generates them.
Yes. The tool automatically detects the format by length and content: if the input field has 14 characters with letters in the first 12, it is treated as an alphanumeric CNPJ; if they are all digits, it is treated as a traditional numeric CNPJ; if it has 11 digits, it is treated as a CPF.
No. The tool automatically removes any punctuation character before validating — you can paste the document with or without formatting.