CPF and CNPJ Validator - Brazil avatar

CPF and CNPJ Validator - Brazil

Pricing

Pay per usage

Go to Apify Store
CPF and CNPJ Validator - Brazil

CPF and CNPJ Validator - Brazil

Valida CPF e CNPJ brasileiros usando algoritmo oficial (modulo 11). Auto-detecta tipo, formata documento. Sem API externa, instantaneo. Lote ate 1000. Gratuito.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Cloway

Cloway

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

1

Monthly active users

5 days ago

Last modified

Share

CPF & CNPJ Validator - Brazil

Validate Brazilian CPF and CNPJ numbers instantly using the official mathematical algorithm (modulo 11 check digits). No external API calls, no API keys, no rate limits -- pure math, blazing fast.

Why use this actor?

  • 100% FREE -- no API key, no subscription, no credits consumed on external services
  • Instant results -- pure algorithm validation, processes 1000 documents in milliseconds
  • Offline algorithm -- uses the same modulo-11 check digit math used by the Receita Federal
  • Auto-detection -- automatically identifies CPF (11 digits) vs CNPJ (14 digits)
  • Formatted output -- returns properly formatted numbers (XXX.XXX.XXX-XX / XX.XXX.XXX/XXXX-XX)
  • Batch support -- validate up to 1000 documents in a single run

Use cases

  • Form validation -- verify CPF/CNPJ before submitting registration forms
  • KYC (Know Your Customer) -- pre-validate documents during onboarding
  • Fraud prevention -- detect obviously fake document numbers
  • Data cleaning -- validate and format document columns in bulk datasets
  • E-commerce -- validate buyer documents at checkout
  • Financial systems -- ensure document integrity before processing transactions

Input

You can provide documents in two ways:

{
"documentos": [
"529.982.247-25",
"18236120000158",
"111.111.111-11"
]
}

Single document

{
"documento": "529.982.247-25"
}

Numbers can include formatting characters (dots, dashes, slashes) or be digits only. The actor strips all non-digit characters before validation.

Output

Each document produces one result in the dataset:

{
"documento": "529.982.247-25",
"tipo": "CPF",
"valido": true,
"formatado": "529.982.247-25"
}
FieldDescription
documentoThe original number as you provided it
tipoCPF, CNPJ, or DESCONHECIDO (wrong digit count)
validotrue if it passes the official check digit algorithm
formatadoProperly formatted number, or null if type is unknown

How the algorithm works

CPF (11 digits)

  1. Strip non-digits, verify 11 digits remain
  2. Reject known invalids (all same digit: 111.111.111-11, etc.)
  3. Calculate first check digit using weights 10,9,8,...,2 on first 9 digits
  4. Calculate second check digit using weights 11,10,9,...,2 on first 10 digits
  5. Both check digits must match positions 10 and 11

CNPJ (14 digits)

  1. Strip non-digits, verify 14 digits remain
  2. Reject all-same-digit sequences
  3. Calculate first check digit using weights 5,4,3,2,9,8,7,6,5,4,3,2 on first 12 digits
  4. Calculate second check digit using weights 6,5,4,3,2,9,8,7,6,5,4,3,2 on first 13 digits

Both use modulo 11: if remainder < 2, check digit = 0; otherwise check digit = 11 - remainder.

Limits

  • Maximum 1000 documents per run (if you send more, only the first 1000 are processed)
  • No rate limiting needed since there are no external API calls

Cost

This actor uses minimal compute since it performs only mathematical calculations. A typical run with 1000 documents costs a fraction of a cent in Apify platform fees.


Developed by NomePronto -- Solucoes digitais para o mercado brasileiro.