Data

CPF Validator (Brazil)

Verify Brazil's Cadastro de Pessoas Físicas in real-time. Complete validation with check digit algorithm.

Instant🔒In your browserNo signup
Live
Try with:

What is the Brazilian CPF?

The CPF (Cadastro de Pessoas Físicas) is Brazil's tax identification document, administered by the Receita Federal since 1968. It consists of 11 numeric digits, with the last two being check digits calculated through a specific algorithm.

CPF is mandatory for all Brazilians and tax residents, functioning as a unique identifier in banking transactions, tax returns, employment contracts, and major purchases. Unlike documents like RG (identity card), the CPF never changes during a person's lifetime.

The standard format is XXX.XXX.XXX-YY, where the first 9 digits (XXX.XXX.XXX) are the base number and the last 2 (YY) are check digits. This system enables instant validation without consulting databases, essential for banking and commercial systems processing millions of daily transactions in Brazil.

How the validation algorithm works

CPF uses a double check digit algorithm based on weighted multiplication:

First check digit calculation (tenth position):

  • Multiply the first 9 digits by the sequence 10, 9, 8, 7, 6, 5, 4, 3, 2
  • Sum all products
  • Subtract the remainder of dividing that sum by 11 from 11
  • If the result is greater than 9, the digit is 0; otherwise, it's the result

Second check digit calculation (eleventh position):

  • Multiply the first 10 digits (including the first check digit) by 11, 10, 9, 8, 7, 6, 5, 4, 3, 2
  • Apply the same process: sum, remainder by 11, subtract from 11

Additionally, the algorithm rejects CPFs with all identical digits (like 111.111.111-11) which, although they would pass mathematical validation, are invalid by Receita Federal definition. This system detects typing errors with 99.1% accuracy.

When and why to validate a CPF

CPF validation is mandatory in virtually any formal transaction in Brazil:

  • Opening bank accounts: all Brazilian banks validate CPF before creating checking, savings, or investment accounts
  • E-commerce and marketplaces: Mercado Livre, B2W, Magazine Luiza require valid CPF for purchases and tax validation of Nota Fiscal Eletrônica
  • Fintech and digital payments: Nubank, PicPay, Inter validate CPF in real-time during onboarding to comply with Central Bank regulations
  • Human resources: companies must validate CPF when hiring formal employees for eSocial and FGTS registrations

Validating before sending to APIs (Receita Federal, SERPRO) avoids rejections that consume query quotas and generate negative experiences. A 2023 study showed that 8% of failed transactions in Brazilian e-commerce are due to invalid or mistyped CPFs.

Limitations and common mistakes

This validator checks the mathematical structure of CPF, but has important restrictions:

  • Does not verify real existence: a CPF can be mathematically valid but never issued by Receita Federal
  • Does not detect cadastral status: doesn't inform if the CPF is active, suspended, canceled, or belongs to a deceased person
  • Does not validate ownership: cannot confirm that the CPF belongs to the person entering it
  • Does not verify tax regularity: a valid CPF may have tax liabilities preventing certain procedures

Common errors: using famous test CPFs (like 111.444.777-35) in production, confusing format with dots/hyphens, copying CPFs with invisible spaces, or assuming mathematical validation equals legal existence. For official verifications, integrate with Receita Federal's CPF Query API or approved services like Serpro.

FAQ

Why is 111.111.111-11 invalid if it passes the algorithm?

The Brazilian Receita Federal defined by regulation that CPFs with all identical digits (111.111.111-11, 222.222.222-22, etc.) are invalid, even though they mathematically pass verification. Validation algorithms explicitly include this additional rule.

Can I use CPF to identify people outside Brazil?

CPF is a Brazilian tax identifier without official validity outside the country. Brazilians residing abroad keep their CPF, but passports are used for international procedures. Some global services accept CPF for Brazilians, but it's not an international standard.

Is it safe to share my CPF?

CPF is sensitive information under Brazilian LGPD (Lei Geral de Proteção de Dados). Sharing it unnecessarily increases identity fraud risk. Only provide your CPF to legitimate companies with justified legal need and never on social media or unsecured sites.

How do I get valid CPFs for testing?

Using real third-party CPFs in testing violates LGPD. Generate mathematically valid CPFs with testing tools (many frameworks have generators) or use official test CPFs. Receita Federal doesn't provide sandbox CPFs, but you can calculate check digits for invented numbers.

Was this generator useful?