CPF
Cadastro de Pessoas Físicas. Brazilian individual taxpayer registry number.
Use this page for field meaning, local checksum math, examples, and integration notes. Official identity, registry, account, or tax status still belongs to the owning system.
Entity Summary
- Jurisdiction
- Brazil (BR)
- Category
- Brazilian Natural Persons Register
- Format
- 11 numeric digits
- Local signal
- Personal tax body, two check digits
What is CPF?
CPF (Cadastro de Pessoas Físicas)
The CPF (Portuguese: Cadastro de Pessoas Físicas, Natural Persons Register) is the Brazilian individual taxpayer identification number.
Managed by the Receita Federal (RFB), it is mandatory for citizens, residents, and non-residents who hold assets or conduct financial transactions in Brazil.
Issuing Authority
The CPF registry is administered by the Secretariat of the Federal Revenue of Brazil (Secretaria da Receita Federal do Brasil).
Visual Structure Breakdown
Standard CPF numbers consist of exactly 11 digits structured as:
[ S S S S S S S S ] [ R ] [ C C ]
| Field | Positions | Description |
|---|---|---|
| SSSSSSSS | 1–8 | Unique taxpayer registration serial. |
| R | 9 | Fiscal region digit (defining state of registration, e.g. 1 for DF/GO, 8 for SP). |
| CC | 10–11 | Double control checksum digits. |
Modulo Checksum Details
The CPF checksum uses a sequential double modulo 11 algorithm.
First Checksum Digit (Digit 10)
Multipliers are applied to the first 9 digits: 10, 9, 8, 7, 6, 5, 4, 3, 2.
\[S_1 = \sum_{i=1}^{9} (d_i \times (11 - i))\]
\[R_1 = S_1 \pmod{11}\]
The control digit is computed as:
- If \(R_1 < 2\), then \(d_{10} = 0\)
- If \(R_1 \ge 2\), then \(d_{10} = 11 - R_1\)
Second Checksum Digit (Digit 11)
Multipliers are applied to the first 10 digits: 11, 10, 9, 8, 7, 6, 5, 4, 3, 2.
\[S_2 = \sum_{i=1}^{10} (d_i \times (12 - i))\]
\[R_2 = S_2 \pmod{11}\]
The control digit is computed as:
- If \(R_2 < 2\), then \(d_{11} = 0\)
- If \(R_2 \ge 2\), then \(d_{11} = 11 - R_2\)
Validation Examples
| Sample Input | Description | Status |
|---|---|---|
| 19123456760 | Valid CPF — Standard valid Brazilian Cadastro de Pessoas Físicas (CPF) number. | ✓ Valid |
| 11111111111 | Trivial Sequential Code — Fails the Receita Federal rule blocking identical repeating digits. | ✗ Invalid |
| 12345 | Too Short — Must be exactly 11 numeric digits. | ✗ Invalid |
Implementation Guidance
Developer Guidelines
When implementing CPF validation:
- CPF is often written with formatting:
000.000.000-00. Separators must be filtered. - Check sum calculations sequentially: Calculate the 10th digit first, then use it to compute the 11th digit.
- Reject trivial sequential numbers (e.g.
111.111.111-11,222.222.222-22), as they are technically invalid under RFB rules but might pass basic checksum tests.
function validateCPF(cpf) {
if (!/^\d{11}$/.test(cpf)) return false;
if (/^(\d)\1{10}$/.test(cpf)) return false;
let sum = 0;
for (let i = 0; i < 9; i++) sum += parseInt(cpf[i]) * (10 - i);
let rev = 11 - (sum % 11);
if (rev === 10 || rev === 11) rev = 0;
if (rev !== parseInt(cpf[9])) return false;
sum = 0;
for (let i = 0; i < 10; i++) sum += parseInt(cpf[i]) * (11 - i);
rev = 11 - (sum % 11);
if (rev === 10 || rev === 11) rev = 0;
return rev === parseInt(cpf[10]);
}
Frequently Asked Questions
What happens if I lose my CPF number?
The CPF number is unique and assigned for life. If lost, you can recover it by submitting an application at a post office, bank, or Receita Federal registry desk.
Can a foreign citizen obtain a CPF?
Yes. Foreigners who own property or hold assets in Brazil are legally required to obtain a CPF.
Official Registry Sources
References
1. Receita Federal (Brazil): Central registry database portal. Official portal.
2. RFB Normative Instruction No. 1548/2015: Administrative act defining the CPF registry rules.