CPF/CNPJ Generator

Generate CPF or CNPJ with valid check digits, masked or not, for test environments.

Overview

The CPF (Cadastro de Pessoa Física) is Brazil’s national identifier for individuals. It links a person to the Federal Revenue and shows up in banking, contracts, tax documents, service sign-ups, and benefits. In practice it plays a role similar to the US Social Security Number (SSN): it does not prove identity by itself, but it is the number used in almost every formal tie to institutions.

Issuance and registry are handled by the Brazilian Federal Revenue (Receita Federal).

With the usual mask, a CPF displays eleven digits as XXX.XXX.XXX-XX. The last two are check digits computed from fixed mathematical rules in regulation. That is why some sequences pass validation and others do not: the algorithm reliably tells whether the pattern matches the official structure.

The CNPJ (National Registry of Legal Entities) identifies companies and other legal entities. It has fourteen digits, typically shown as XX.XXX.XXX/XXXX-XX, again with official check-digit formulas.

For developers: both CPF and CNPJ can start with zero. Storing or parsing them as int, float, or double often drops leading zeros or risks precision issues. Treat them as strings end to end.

This tool is for development and QA only. Do not use it for fraud or improper real registrations. Generated numbers follow the official check-digit algorithm.

Tool guide

  • O que são CPF e CNPJ Identificadores brasileiros de pessoa física e jurídica, com dígitos verificadores calculados por regras oficiais.
  • O que a ferramenta faz Gera números que passam na validação de dígitos, com ou sem máscara, para uso em testes.
  • Por que usar Preencher homologação, QA e demos sem usar documentos reais. Não usar para fraude; pode coincidir com números existentes.

Typical use

Ambiente de homologação: preencher formulários com CPF/CNPJ sintaticamente válidos.

FAQ

Do these numbers belong to real people?

Generation is random among valid check-digit combinations. Collisions are possible; use only in tests.

What is this tool for?

It runs fully in your browser: useful to validate, format, or convert data in everyday development.

Are my inputs sent to a server?

Processing happens locally with JavaScript. We do not store what you paste into the text areas.

Can I use this for real production data?

Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.