Test data

Valid CPF generator

Generate mathematically valid Brazilian CPF numbers to test your software — one or a thousand at a time, formatted or as plain digits, with the option to pick the issuing state.

  • 100% in the browser
  • free
  • no sign-up
Legal notice: the numbers generated here are fictitious and exist solely for software testing and development. They do not belong to real people or companies. Using fake documents for fraud, to sign up for services or for any unlawful purpose is a crime in Brazil (arts. 171 and 299 of the Penal Code).
What do you want to generate?

The generated documents show up here. Pick the options above and click “Generate”.

How to generate a valid CPF

Set how many you want (from 1 to 1000), choose whether the output is formatted — 295.379.955-93 — or just the eleven digits, and click Generate. Each number is drawn at random in the first nine positions and closed with two check digits computed by the Modulo 11 algorithm, the same one Receita Federal uses. Copy the whole batch at once or download it as JSON, CSV and SQL INSERT statements with the table name of your choice — ready to seed a staging database.

If you need more than the number itself, the full test-record mode assembles fictional Brazilian records with name, email, phone, postal code and date of birth alongside the CPF. None of it leaves your machine: generation happens entirely in the browser, with no document sent to or stored on CodeCrush servers.

CPF by state: what the 9th digit reveals

A CPF is not entirely random. The ninth position — the digit right before the two check digits — identifies the Receita Federal fiscal region where the document was issued. That is why the generator lets you pick the state: it fixes the correct digit in that position and returns a CPF consistent with it, which matters when your system has region-specific business rules, routing or reporting.

Ninth-position CPF digit by fiscal region and matching states
9th digitFiscal regionStates
010th fiscal regionRS
11st fiscal regionDF, GO, MS, MT and TO
22nd fiscal regionAC, AM, AP, PA, RO and RR
33rd fiscal regionCE, MA and PI
44th fiscal regionAL, PB, PE and RN
55th fiscal regionBA and SE
66th fiscal regionMG
77th fiscal regionES and RJ
88th fiscal regionSP
99th fiscal regionPR and SC

A valid CPF is not the same as an existing CPF

This distinction is the source of half the confusion about CPF generators. A valid CPF is merely a number whose check digits satisfy the Modulo 11 maths — that is what this tool produces and what virtually every form checks. An existing CPF is a number actually registered and active in the Receita Federal database, tied to a person. The documents generated here are valid and not existing; no public tool can tell you whose a CPF is, because that requires restricted access to the Receita database.

The Validate CPF tab opens that black box: for whatever number you type, it shows each multiplication by weight, the sum, the remainder of the division by 11 and the expected digit. It is the fastest way to understand why a CPF passes or fails — and to check that your own implementation is right.

When to use it (and when not to)

  • Testing sign-up form validation in development and QA;
  • Seeding staging databases with realistic fixtures, via the SQL export;
  • Writing automated tests that need valid, varied CPF numbers;
  • Checking that your validator rejects cases such as 111.111.111-11;
  • Demoing a product without exposing any real customer's document.

What is off limits: using a generated document to sign up for a real service, to commit fraud or to impersonate someone. That is a crime under articles 171 and 299 of the Brazilian Penal Code, and no test case justifies it.

Need a CNPJ as well?

Use the CNPJ generator, which covers the numeric format and the new alphanumeric one introduced in 2026, and also looks up real company data in the Receita Federal registry. If what you want is to generate CPF and CNPJ in bulk on one screen, with full fictional records and SQL export, the combined version does both at once.

## faq

Frequently asked questions

How do I generate a valid CPF?

Choose how many numbers you want, whether the output comes formatted (with dots and a dash) or as plain digits, and click Generate. The tool draws the first 9 digits at random and calculates the 2 check digits with the Modulo 11 algorithm — the same one Receita Federal uses — so every CPF produced here passes any form validation. Everything runs in your browser: no number is uploaded or stored.

Does the generated CPF belong to a real person?

No. The number is drawn at random and only satisfies the check-digit rule; it is never looked up in or registered with any Receita Federal database. A CPF carries no name, date of birth or any other personal data inside it — it is simply a numeric sequence with a verification rule.

Is it legal to use a CPF generator?

Yes, for software testing: validating sign-up forms, seeding development databases, writing automated tests and running demos. What is a crime is using a fake document for fraud, to sign up for a real service or to impersonate someone — articles 171 (fraud) and 299 (false statement) of the Brazilian Penal Code. The generator is a QA tool, not a shortcut around identity checks.

What is the difference between a valid CPF and an existing CPF?

A valid CPF is a number whose check digits satisfy the Modulo 11 maths — that is what this generator creates and what most forms check. An existing CPF is a number actually registered and active in the Receita Federal database, tied to a person. The CPFs generated here are valid but not existing. No public tool can tell you who a CPF belongs to: that requires restricted access to the Receita database.

How is the CPF check digit calculated?

The first 9 digits are multiplied by the weights 10, 9, 8, 7, 6, 5, 4, 3 and 2; the products are added up and the sum is divided by 11. If the remainder is less than 2, the first check digit is 0; otherwise it is 11 minus the remainder. The second digit repeats the calculation including the first check digit, with weights from 11 down to 2. The Validate tab on this page shows the maths step by step for whatever number you type.

What does the ninth digit of the CPF mean?

The ninth position (the digit right before the two check digits) identifies the Receita Federal fiscal region where the CPF was issued. There are ten regions — for example, 8 is São Paulo, 7 is Rio de Janeiro and Espírito Santo, 6 is Minas Gerais and 0 is Rio Grande do Sul. That is why the generator lets you pick the state: it fixes the correct digit in that position and produces a CPF consistent with that state, which is handy for testing region-specific business rules.

Why is 111.111.111-11 rejected if the maths adds up?

Because sequences with every digit repeated pass Modulo 11 by mathematical coincidence, but are rejected by a blacklist adopted by virtually every Brazilian system. There are eleven such numbers, from 000.000.000-00 to 999.999.999-99. A validator that forgets this list accepts the most obvious CPF a bad actor will try — worth adding those cases to your test suite.

Can I generate many CPFs at once and export them?

Yes. You can generate from 1 to 1000 CPFs in one go and copy the result or download it as JSON, CSV or SQL INSERT statements with the table name of your choice — ready to seed a staging database. The full test-record mode goes beyond the number and assembles fictional Brazilian records with name, email, phone, postal code and date of birth alongside the CPF.

## other tools