Skip to content

CPF Generator
Brazilian CPF Generator

Generate valid CPF numbers for software testing in one click.

What is a CPF number?

The CPF, short for Cadastro de Pessoas Físicas, is the tax identification number the Brazilian government issues to individuals. It has 11 digits and works much like a Social Security Number in the United States or a National Insurance number in the United Kingdom.

Brazilians use it to open bank accounts, sign contracts, buy on credit, receive public services and file taxes. Foreigners living in Brazil also need one for almost any financial activity, and it is requested at customs when a parcel is shipped to a Brazilian buyer.

Why developers need test CPF numbers

Any system that serves Brazilian users validates the CPF before saving a record. Automated tests, staging environments and demo data therefore need numbers that pass that validation without belonging to a real person.

The numbers produced here are mathematically valid: the two check digits match the official algorithm. They are not registered with the Receita Federal and are not linked to anyone, which is exactly what you want in a test database.

Use them for unit tests, seed data, form validation, QA scripts and API sandboxes. Never use a generated CPF to impersonate a person or to open an account. In Brazil that is a crime under Article 299 of the Penal Code.

How the CPF check digits work

The first nine digits are the base number. The tenth digit is calculated by multiplying those nine digits by weights from 10 down to 2, summing the results, multiplying the remainder of the division by 11, and taking 11 minus that value; a result of 10 or 11 becomes 0.

The eleventh digit repeats the process over the first ten digits, with weights from 11 down to 2. Because both digits derive from the rest of the number, a typo almost always produces an invalid CPF, which is why forms can catch mistakes before hitting a database.

The third digit from right to left also encodes the fiscal region where the number was issued: 0 Rio Grande do Sul, 1 Federal District and the Central-West, 2 the North, 3 Ceará, Maranhão and Piauí, 4 the eastern Northeast, 5 Bahia and Sergipe, 6 Minas Gerais, 7 Rio de Janeiro and Espírito Santo, 8 São Paulo, 9 Paraná and Santa Catarina.

Frequently Asked Questions

What is a CPF generator?

A CPF generator is an online tool that creates Brazilian CPF numbers which are mathematically valid, meaning the two check digits follow the official algorithm. The numbers are meant for software testing and are not registered to any person.

Is it legal to use a generated CPF?

Yes, for software testing and development. The numbers are valid in form but not registered with the Receita Federal. Using one to impersonate someone, open an account or commit fraud is a crime in Brazil under Article 299 of the Penal Code.

How many digits does a CPF have?

Eleven digits: nine base digits plus two check digits. Formatted, it looks like 000.000.000-00.

How do I validate a Brazilian CPF?

Recalculate the two check digits from the first nine digits and compare them with the last two. Sequences where every digit is the same, such as 111.111.111-11, pass the arithmetic but are rejected as invalid. Paste any number in the field above and click Validate CPF.

What is the difference between CPF and CNPJ?

CPF identifies an individual and has 11 digits. CNPJ identifies a company and has 14. Both are issued by the Receita Federal and both end in check digits.

Can a foreigner get a CPF?

Yes. Any foreigner with assets, income or business in Brazil can apply, including from abroad through a Brazilian consulate. The registration itself is free of charge at the Receita Federal.