What is CPF?
The Individual Taxpayer Registry (CPF) is the record maintained by the Federal Revenue Service that identifies Brazilian citizens and residents with tax obligations. The number has 11 digits: nine identifiers and two check digits responsible for validating the document's integrity.
Every relevant financial transaction — opening an account, obtaining credit, filing an Income Tax return — requires a valid CPF. Ensuring the provided document is legitimate prevents fraud and rework.
How is CPF calculation done?
CPF numerical validation follows three main steps: multiplication by weights, application of modulo 11, and comparison with the provided digits. Weights range from 10 to 2 in the first round and from 11 to 2 in the second, incorporating the first calculated check digit.
| Step | Description | Example (123.456.789-09) |
|---|---|---|
| 1st check digit | Multiplies the 9 digits by weights from 10 to 2, sums and applies modulo 11. | Remainder 9 → 11 - 9 = 2 (since >= 2, becomes 2). |
| 2nd check digit | Repeats the process with weights from 11 to 2 and includes the first check digit. | Remainder 11 → 11 - 11 = 0 (final result 0). |
| Final validation | Compares the calculated digits with the two provided digits. | Since 2 and 0 match, the CPF is valid. |
Our calculator automates the entire process, ensuring consistency with the official algorithm and enabling quick audits on large databases.
Best practices for product teams
- Validate CPF on the frontend to reduce friction and repeat the check on the backend before saving the record.
- Store only masked CPFs on administrative screens, protecting sensitive data.
- Configure test suites with CPFs generated by this tool, avoiding real information during staging.
- Combine with the {validadorCnpj} to validate partner company registrations.
Validation vs. registration status
Although the algorithm identifies mathematically legitimate CPFs, the registration status — active, suspended, canceled — can only be checked at the Federal Revenue. For secure onboarding, use this validation as an initial filter and, if necessary, integrate official services to verify fiscal status.