Free online tool

CPF Generator and Validator

Generate, validate, and export fictional Brazilian CPF numbers by state for software testing.

Generate CPF

Create valid fictional data for software testing.

Generated result

Validate CPF

Check format and check digits without querying official records.

Numbers are generated locally. Only the latest 10 are saved in this browser, and no data is sent to CosmoTools.

Prefer Portuguese? Use o gerador de CPF em português.

How to generate and validate a CPF

Choose a state, punctuation, and a batch size from 1 to 50. Copy the batch or export JSON and CSV. To validate a test value, enter its eleven digits with or without punctuation; the browser recalculates both check digits without querying official records.

What is a fictional CPF used for?

Generated CPFs help developers test forms, input masks, validation rules, imports, APIs, and staging environments without using real personal data. They are also useful in automated test fixtures.

A mathematically valid CPF does not necessarily identify a person and must not be used for real registrations, fraud, or impersonation.

Check-digit example

A CPF contains nine base digits followed by two check digits. Base 529982247 produces 25 through two weighted modulo-11 steps, resulting in 529.982.247-25.

CPF generation by state

When a state is selected, the tool uses the digit associated with its Brazilian Federal Revenue fiscal region in the ninth position of the CPF base. Multiple states can share the same region digit.

Formatted and unformatted CPF

Use a value such as 529.982.247-25 to test masked fields. Disable punctuation to get the 11-digit representation commonly used in APIs, databases, and data files.

Official reference and related test data

The Brazilian Federal Revenue explains the fiscal-region digit in its official CPF material. Use the Brazilian Person Generator for complete fictional records or the CNPJ Generator and Validator for company identifiers.

Frequently asked questions

Does a generated CPF belong to a real person?

Not necessarily. The tool creates a fictional sequence with mathematically valid check digits without querying the Brazilian Federal Revenue database.

Can I use generated CPFs for testing?

Yes. They are intended for development, staging environments, form masks, validators, APIs, and test fixtures.

Can I generate a CPF without punctuation?

Yes. Disable punctuation to receive only the 11 digits.

Can I choose the CPF state?

Yes. The tool uses the fiscal-region digit associated with the selected state when building the CPF base.

Can I validate or export CPFs?

Yes. Validation checks the format and check digits, and generated batches can be copied or downloaded as JSON and CSV.

Are generated CPFs stored?

Only the latest 10 are kept in your browser local storage. Results are never sent to CosmoTools.

How the tool works

Choose a state, punctuation, and a batch size, then generate fictional CPFs with mathematically consistent check digits. Copy the batch or export JSON and CSV. The validator independently compares the two provided digits with the digits calculated from the nine-digit base.

Supported input and output

A CPF contains nine base digits followed by two modulo-11 check digits. The formatted representation uses dots and a hyphen, while APIs and databases often expect the same eleven digits without punctuation.

Practical example

For base 529982247, the modulo-11 steps produce digits 25, resulting in 529.982.247-25. Use the formatted value for an input mask and the raw eleven digits in an API payload.

Common use cases

Generated CPFs support form validation, staging environments, automated tests, imports, database constraints, and demonstrations without intentionally using someone’s personal identifier.

Limits and important checks

A mathematically valid CPF may coincide with an issued number and does not prove identity or registration status. Never use generated data for real accounts, fraud, impersonation, or consultation of private records.

Privacy and local processing

Unless the tool explicitly identifies an external lookup, input and generated output are processed in your browser and are not uploaded to CosmoTools. Avoid placing secrets in any web page and review downloaded results before using them in production.