utilduck
Home · Office · CPF Generator & Validator

CPF Generator & Validator

Validate an existing CPF's two check digits, or generate a random CPF with valid check digits for software testing — both use Brazil's official mod-11 algorithm.

Validate a CPF

This checks mathematical validity only — that the two check digits match the mod-11 formula. It cannot confirm the CPF was actually issued, belongs to a real person, or is currently active. For that, use the official Receita Federal CPF lookup (Consulta CPF).

Formatted CPF
-

Generate a test CPF

Generated numbers are random test data with mathematically valid check digits — they do not belong to, or identify, any real person. Use them only for software testing and form/QA purposes, such as testing a signup form's CPF field. Using a generated CPF to impersonate someone or commit fraud is illegal in Brazil.

Generated CPF
-

How the CPF check digits are calculated

A CPF has 9 base digits plus 2 check digits. The first check digit multiplies each of the 9 base digits by a descending weight from 10 to 2, sums the products, takes that sum times 10 modulo 11, and maps a result of 10 or 11 to 0. The second check digit repeats the same process on all 10 digits (the 9 base digits plus the first check digit), using weights from 11 down to 2.

Sequences that repeat a single digit 11 times (000.000.000-00, 111.111.111-11, and so on) mathematically satisfy this formula but are never issued by Receita Federal, so this tool flags them as invalid even though the checksum passes — the same rule used by Brazil's Receita Federal and by other CPF validators.

How do I calculate a CPF's two check digits?

Multiply the 9 base digits by descending weights from 10 to 2, sum the products, multiply by 10, and take the remainder modulo 11 (mapping 10 or 11 to 0) to get the first check digit; then repeat the same process on all 10 digits (base plus first check digit) with weights from 11 to 2 to get the second. Example: base 111.444.777 produces check digits 3 and 5, giving 111.444.777-35.

Steps to calculate or validate a CPF

  1. Remove any dots and hyphen, keeping only the digits.
  2. For the first check digit, multiply the 1st base digit by 10, the 2nd by 9, and so on down to the 9th digit by 2; add all 9 products together.
  3. Multiply that sum by 10, divide by 11, and keep the remainder; if the remainder is 10 or 11, use 0 instead — this is the first check digit.
  4. For the second check digit, repeat the same weighted-sum process across all 10 digits (the 9 base digits plus the first check digit just computed), using weights 11 down to 2.
  5. If a full 11-digit CPF was entered, compare both computed digits to the two digits actually entered to determine validity; if only 9 digits were entered, display the two computed digits as the answer.

Formula

DV1 = f(d1..d9, weights 10..2); DV2 = f(d1..d9,DV1, weights 11..2), where f(x) = ((sum(digit x weight)) x 10) mod 11, mapping 10 and 11 to 0
  • d1..d9 = the 9 base digits of the CPF, in order
  • DV1, DV2 = the first and second check digits, computed one after the other
  • weight = the multiplier for each position, descending by 1 for each digit to the right

Example CPF numbers and their check digits

Base (9 digits)DV1DV2Formatted
11144477735111.444.777-35
10433218100104.332.181-00
96001338914960.013.389-14
08386379499083.863.794-99
12345678909 (invalid check)123.456.789-09

Frequently asked questions

Why does 111.444.777-35 keep showing up as a valid test CPF?

It's a widely used example number in tutorials and QA test suites because it is easy to remember and mathematically valid, not because it has any special status with Receita Federal — it works purely because its check digits satisfy the mod-11 formula, exactly like any other correctly generated CPF.

Why does this tool reject 111.111.111-11 as invalid even though the math checks out?

Sequences that repeat a single digit 11 times happen to satisfy the mod-11 formula by mathematical coincidence, but Receita Federal's issuance rules exclude them entirely — no real CPF has ever been issued with all repeated digits, so validators, including this one, treat them as invalid despite the checksum passing.

Is it legal to use a randomly generated CPF?

Yes, for legitimate purposes such as testing software forms, database seeding, or QA automation, since a randomly generated number with valid check digits does not identify any real person. It becomes illegal the moment it is used to impersonate someone, open an account fraudulently, or otherwise deceive a person or system into believing it belongs to a real individual.

Can this tool tell me who a CPF belongs to?

No, and it never will — this tool only performs the public mod-11 checksum calculation locally in your browser. Looking up who a CPF is registered to (if anyone) requires the person's authorization and access to Receita Federal's restricted systems; there is no legitimate free public lookup for that information.

This tool implements the public mod-11 check-digit algorithm only, entirely in your browser; it does not verify that a CPF was actually issued, is currently active, or belongs to a real taxpayer, and it does not connect to any government database. Use Receita Federal's official Consulta CPF service for real identity or status verification.

Sources: Receita Federal — Consulta CPF