Skip to content
LeedyBox
Support

CPF and CNPJ Validator

Check the check digits of a Brazilian CPF or CNPJ, including the new alphanumeric CNPJ, and see it formatted.

11 digits for a CPF, 14 characters for a CNPJ. Dots, slash and hyphen are optional. Enter 9 or 12 characters to get the check digits.

Enter a number to see the result.

The result says only whether the number has the right form and check digits. It does not tell you whether the number is registered, its status with the Receita Federal or who it belongs to.

Test numbers

Test values only. Do not use them as the number of a real person or organisation.

Random numbers with correct check digits, for development and testing. A random number can match one that has really been issued. Numeric test CNPJs use the order 0001.

How the check digits are calculated

  • CPF: 11 digits, the last two being check digits. For the 10th digit, multiply the first nine digits by 10, 9, … 2, add the results and divide by 11: a remainder of 0 or 1 gives 0, otherwise the digit is 11 minus the remainder. The 11th digit is calculated the same way from the first ten digits, with weights 11 … 2.
  • The 9th digit of a CPF is the fiscal region (Região Fiscal) of the address given at the first registration: 1 DF, GO, MT, MS, TO; 2 PA, AM, AC, AP, RO, RR; 3 CE, MA, PI; 4 PE, RN, PB, AL; 5 BA, SE; 6 MG; 7 RJ, ES; 8 SP; 9 PR, SC; 0 RS.
  • CNPJ: 14 characters, an 8-character root, a 4-character order and two check digits. Each of the first 12 characters counts as its ASCII code minus 48, so digits keep their value and A = 17 … Z = 42. The weights 2 to 9 run from the right and start again after 9; the remainder rule is the same as for the CPF.
  • From July 2026 the Receita Federal gives alphanumeric CNPJs, with letters A–Z in the root and the order, to new registrations only. Existing CNPJs do not change, and the check digits are always two digits.
  • Everything runs in your browser. The numbers you enter are not sent to LeedyBox or saved.

Source: Receita Federal: folheto «Cadastros – CPF e CNPJ» · Last checked:

Source: Receita Federal / Serpro: Cálculo dos dígitos verificadores de CNPJ alfanumérico · Last checked:

Source: Receita Federal: CNPJ alfanumérico – Perguntas e respostas · Last checked:

Source: Receita Federal: CNPJ Alfanumérico · Last checked:

Wrong result? If a number that was really issued is marked as wrong, email us. Please do not send the number itself: tell us whether it is a CPF or a CNPJ and which check digit failed, or send a generated test number that shows the problem.

Does a sentence on this page sound unnatural in your language? Let us know that too.

support@leedybox.com

Check the results before you use them. The tool is provided as is, without warranty, and its results can be incomplete or wrong. Terms of Service

Only the Receita Federal can confirm that a CPF or CNPJ is registered and what its status is; correct check digits do not prove it.

How to use

  1. Type or paste a CPF (11 digits) or a CNPJ (14 characters). Dots, slash and hyphen are optional, and lower-case letters are read as capitals.
  2. If you have only the base number, enter 9 digits for a CPF or 12 characters for a CNPJ: the tool shows the check digits and the full formatted number.
  3. For software tests, choose CPF, numeric CNPJ or alphanumeric CNPJ and how many you need, then press Generate.

Frequently asked questions

How are the CPF check digits calculated?

Multiply the first nine digits by 10, 9, 8 … 2, add the results and divide by 11. If the remainder is 0 or 1 the first check digit is 0, otherwise it is 11 minus the remainder. The second digit is calculated the same way from the first ten digits with weights 11 … 2. For 280.012.389 the first sum is 162, which leaves 8, so the first digit is 3; the second sum is 201, which leaves 3, so the second digit is 8. The result, 280.012.389-38, is the Receita Federal's own example.

What is the alphanumeric CNPJ?

From July 2026 the Receita Federal gives new registrations CNPJs whose first 12 characters may contain capital letters A–Z as well as digits, for example 12.ABC.345/01DE-35. The number still has 14 positions and the two check digits are always digits. CNPJs issued before keep their numbers, so systems have to accept both forms.

How are letters counted in the CNPJ check digits?

Each character counts as its ASCII code minus 48: digits keep their value, A = 17, B = 18 … Z = 42. With the weights 2 to 9 from the right, the first 12 characters of 12.ABC.345/01DE add up to 459; 459 divided by 11 leaves 8, so the first check digit is 11 − 8 = 3. The second digit, 5, is calculated the same way over 13 characters. Because digits keep their value, the same calculation works for numeric CNPJs.

Does a valid result mean the CPF or CNPJ exists?

No. Correct check digits only show that the number is well formed. Whether a CPF or CNPJ is registered, and its status (situação cadastral), can only be checked with the Receita Federal.

What does the 9th digit of a CPF mean?

It is the fiscal region of the address given when the CPF was first registered, for example 8 for São Paulo and 7 for Rio de Janeiro and Espírito Santo. It does not change when the person moves, so it does not tell you where they live now.