Developer Tools / CPF Validator

CPF Validator

Check if a CPF is mathematically valid by verifying its check digits.

more digit(s) needed

API Endpoint

GET /api/tools/validate/cpf/{cpf}

Response includes: isValid, formatted, unformatted

How CPF Validation Works

The CPF (Cadastro de Pessoa Fisica) is the Brazilian tax identification number for individuals. It consists of 11 digits, where the last two are verification digits calculated using a specific algorithm.

CPF Structure

  • First 9 digits: Base number (includes regional code)
  • Last 2 digits: Check digits (calculated from the first 9)

Regional Codes

The 9th digit of a CPF indicates the issuing region:

  • 0 - RS
  • 1 - DF, GO, MS, MT, TO
  • 2 - AC, AM, AP, PA, RO, RR
  • 3 - CE, MA, PI
  • 4 - AL, PB, PE, RN
  • 5 - BA, SE
  • 6 - MG
  • 7 - ES, RJ
  • 8 - SP
  • 9 - PR, SC

Check Digit Algorithm

The check digits are calculated using weighted multiplication and modular arithmetic (mod 11). Our validator performs this calculation and compares the result with the provided digits.

Privacy Note

CPF numbers are personal data protected by Brazilian privacy laws (LGPD). This tool only validates the mathematical structure - it does not verify identity or store any data.