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.

Technical deep dive

Common questions summarized

  • 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.

Sample payload to try

  • See also the larger "Code Snippets" sample; paste this excerpt to try locally: Typical use — Ambiente de homologação: preencher formulários com CPF/CNPJ sintaticamente válidos.

Tool guide

  • What CPF and CNPJ are Brazilian identifiers for individuals and companies, with check digits computed by official rules.

  • What the tool does Generates numbers that pass check-digit validation, with or without masking, for testing only.

  • Why use it Fill staging, QA, and demos without real documents. Do not use for fraud; collisions with real numbers are possible.

Code Snippets

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

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.