The UpTools CPF generator creates valid CPF numbers for software testing. The CPF (Cadastro de Pessoas Físicas) is Brazil’s individual taxpayer number. You choose how many you need (from 1 to 20), decide whether you want the punctuated format (000.000.000-00) and, if necessary, set the state of origin. The numbers come with the correct check digits and are ready to copy.
These CPFs are fictitious: they are created at random in your browser, without querying any database, and do not represent any person. Use them to fill in test forms, populate development databases and check validation rules.
What is a CPF?
The CPF is the number that the Receita Federal (Brazil’s Federal Revenue Service) assigns to each taxpayer. It has 11 digits: the first 8 form the base number, the 9th indicates the fiscal region where the CPF was issued and the last 2 are check digits, calculated from the previous ones to catch typing errors.
How to use the CPF generator
- Under State of origin, keep “Any state” or choose a fiscal region, such as SP or “RJ, ES”.
- Set the Quantity of CPFs, from 1 to 20.
- Turn on Format with punctuation to get the 000.000.000-00 pattern; with the option off, you get digits only.
- Click Generate CPF. When you change the state or the punctuation, the list also updates instantly.
- Copy a single number with the button next to it, or use Copy all to take the whole list.
How the check digits are calculated
The last two digits of a CPF are obtained with a modulo 11 calculation:
- Multiply the first 9 digits by the weights 10, 9, 8, 7, 6, 5, 4, 3 and 2, in that order, and add up the results.
- Divide the sum by 11 and look at the remainder. If the remainder is 0 or 1, the first check digit is 0; otherwise, it is 11 minus the remainder.
- For the second digit, repeat the process with the first 10 digits (now including the first check digit) and the weights 11 down to 2.
Here is an example with the base 287.453.168, where the 9th digit (8) indicates São Paulo:
- First digit: 2×10 + 8×9 + 7×8 + 4×7 + 5×6 + 3×5 + 1×4 + 6×3 + 8×2 = 259. The remainder of 259 ÷ 11 is 6, and 11 − 6 = 5.
- Second digit: 2×11 + 8×10 + 7×9 + 4×8 + 5×7 + 3×6 + 1×5 + 6×4 + 8×3 + 5×2 = 313. The remainder of 313 ÷ 11 is 5, and 11 − 5 = 6.
The complete CPF is 287.453.168-56. The generator also discards sequences where all digits are the same, such as 111.111.111-11, which pass the calculation but are rejected by validators.
CPF by state of origin
The 9th digit of a CPF indicates the fiscal region where the number was issued. When you choose a state, the generator sets that digit according to this table (the abbreviations are Brazilian states):
| 9th digit | States |
|---|---|
| 0 | RS |
| 1 | DF, GO, MS, MT and TO |
| 2 | AM, PA, AC, AP, RO and RR |
| 3 | CE, MA and PI |
| 4 | PE, RN, PB and AL |
| 5 | BA and SE |
| 6 | MG |
| 7 | RJ and ES |
| 8 | SP |
| 9 | PR and SC |
This helps you test rules that depend on the region, such as reports by state. Keep in mind that the digit shows where the CPF was issued, not where the person lives today.
What it is for
- Testing sign-up forms, input masks and error messages;
- Populating development and staging databases without real personal data;
- Building automated test scenarios, from unit tests to end-to-end tests;
- Studying and implementing validation algorithms in programming classes.
If your system also registers companies or drivers, use the CNPJ generator (Brazilian company numbers) and the CNH generator (Brazilian driver’s license numbers). For testing payments, there is the credit card generator.
Responsible use
The generated CPFs are for testing and educational purposes only. They were not issued by the Receita Federal and do not identify anyone. Using them to open accounts, make purchases, impersonate someone or deceive companies or government agencies is illegal and may constitute crimes under Brazilian law, such as identity fraud and swindling.
Frequently asked questions
Is the generated CPF real?
It is valid only in format: it passes the check-digit verification, but it has not been assigned to you or to anyone else. Since hundreds of millions of CPFs have been issued, a randomly drawn number may match a real CPF by chance, which is why it should stay in test environments.
Can I use a generated CPF to sign up on websites or make purchases?
No. Entering a CPF that is not yours in real sign-ups is illegal, even if the number was generated at random.
How do I validate a CPF?
Redo the check-digit calculation described above, compare the result with the last two digits and reject repeated sequences. This test only confirms the structure: only the official Receita Federal lookup shows whether a CPF exists and is in good standing.
Are the generated CPFs saved?
No. The numbers are generated in your browser and are not sent to or stored on UpTools servers.