CPF generator and validator
The CPF is the individual taxpayer ID issued by Brazil’s Federal Revenue Service (Receita Federal). Use this tool to create fictitious but mathematically valid CPFs for test fixtures, sandbox integrations and form validation, all computed in your browser.
Up to 1000 items at once. Everything is generated in your browser.
How to use
- On the generator tab, optionally choose a UF (Brazilian state) to get a CPF from that fiscal region; leave it empty for a random one.
- Toggle With mask (punctuation) to get
000.000.000-00or the plain 11 digits. - Click Generate, then Copy to put the number on your clipboard.
- For seed data, set the Quantity (1–1000) and use Export CSV or Export JSON.
- On the Validate tab, paste one or many CPFs, one per line; each line is marked valid or invalid with the reason.
How it works
Structure of a CPF
A CPF (Cadastro de Pessoas Físicas) has 11 digits. The first 8 are the base number, the 9th identifies the fiscal region where it was registered, and the last 2 are check digits computed with a modulo-11 rule. If you integrate with Brazilian payment, e-commerce or KYC APIs, you will usually be asked to validate this field before sending it.
| 9th digit | States (UF) |
|---|---|
| 1 | DF, GO, MS, MT, TO |
| 2 | AC, AM, AP, PA, RO, RR |
| 3 | CE, MA, PI |
| 4 | AL, PB, PE, RN |
| 5 | BA, SE |
| 6 | MG |
| 7 | ES, RJ |
| 8 | SP |
| 9 | PR, SC |
| 0 | RS |
Choosing a state only fixes that 9th digit; the rest of the base stays random.
Check-digit algorithm
- Multiply the first 9 digits by the weights 10, 9, 8, 7, 6, 5, 4, 3, 2 and add the products.
- Take the remainder of the sum divided by 11. If it is below 2, the digit is 0; otherwise it is 11 − remainder.
- For the second digit, repeat with the 10 digits (base + first check digit) and weights 11 down to 2.
Worked example: 528.416.379-??
First digit: 5×10 + 2×9 + 8×8 + 4×7 + 1×6 + 6×5 + 3×4 + 7×3 + 9×2 = 50 + 18 + 64 + 28 + 6 + 30 + 12 + 21 + 18 = 247. 247 mod 11 = 5, so the digit is 11 − 5 = 6.
Second digit: 5×11 + 2×10 + 8×9 + 4×8 + 1×7 + 6×6 + 3×5 + 7×4 + 9×3 + 6×2 = 55 + 20 + 72 + 32 + 7 + 36 + 15 + 28 + 27 + 12 = 304. 304 mod 11 = 7, so the digit is 11 − 7 = 4.
Result: 528.416.379-64, 9th digit 9 (PR or SC). Strings of identical digits such as 111.111.111-11 pass the arithmetic, but the validator rejects them because they are not accepted registrations.
FAQ
Are the generated CPFs real people’s numbers?
They are random numbers that only satisfy the check-digit rule. The tool never queries any Receita Federal database, so there is no intended link to any person. Use them only for testing, staging, demos and fixtures, never to register for real services.
Does “valid” mean the CPF is active at Receita Federal?
No. The validator checks characters, length, repeated digits and both check digits. Whether a CPF is active, suspended or cancelled can only be confirmed through official Receita Federal services, which this tool does not access.
What is the state (UF) option for?
It fixes the 9th digit, which encodes the fiscal region of registration. That helps when testing features that display or filter by the CPF’s region of origin. Several states share one digit, for example 1 covers DF, GO, MS, MT and TO.
Should I store CPFs with or without the mask?
Most systems store the 11 digits in a text column, which keeps leading zeros, and apply the 000.000.000-00 mask only when displaying. The validator accepts both formats, including spaces, and returns the formatted number.
Why does my own validator accept 000.000.000-00?
Because repeated-digit strings satisfy the modulo-11 arithmetic. Any CPF validation needs an extra rule rejecting them. Paste a list in the Validate tab and you will see those lines flagged with the repeated-digits reason.
Sources
Related tools
Updated 2026-11-13 · Rafael Lima