CPF/CNPJ Generator

Generate valid CPF and CNPJ numbers for testing and development. Validate existing documents.

For testing and development purposes only
Formatted output
120

CPF/CNPJ Generator

CPF (Cadastro de Pessoas Físicas) is the Brazilian individual taxpayer registry, an 11-digit number used to identify individuals for tax and financial purposes. CNPJ (Cadastro Nacional da Pessoa Jurídica) is the 14-digit registry for businesses. Both use modulo-11 check digit algorithms to ensure validity.

This tool generates valid CPF and CNPJ numbers with correct check digits for software testing and development. It also includes a validation mode to verify whether an existing CPF or CNPJ has valid check digits. All generation and validation is performed locally in your browser.

How it works

CPF check digits use weights 10-2 (first digit) and 11-2 (second digit) with mod 11. CNPJ uses weights 5,4,3,2,9,8,7,6,5,4,3,2 (first) and 6,5,4,3,2,9,8,7,6,5,4,3,2 (second) with mod 11. If remainder < 2, the check digit is 0; otherwise it is 11 - remainder.

Use cases

  • Testing form validation for Brazilian document fields
  • Populating test databases with valid document numbers
  • Verifying CPF/CNPJ check digit algorithms in your code
  • QA testing of payment and registration flows

Related Calculators