CNPJ validator and generator

Validate a CNPJ and learn how its check digit works, with a worked example.

loading CNPJ validator and generator
About this tool

CNPJ: what it is and how to test it

The CNPJ is the national register number of a company in Brazil, issued by the Receita Federal. A validator tells you whether a number is well formed: the right length and check digits. It does not tell you whether the company exists, which only a query to the Receita can.

For tests only. These numbers have a correct format and check digit but belong to no real person or account. Never use them to deceive, to open accounts or to bypass a check. The numbers on this page come from the same generator as the tool, with a fixed seed so that the examples do not change; the tool creates new ones at every click.

Structure of the number

14 positions: 8 for the root of the company, 4 for the branch (0001 is the head office) and 2 check digits, written as 00.000.000/0001-00. Since July 2026 new numbers may carry letters in the first 12 positions; the page "alphanumeric CNPJ" covers them.

The check digit, step by step

Both check digits use module 11. Each of the first 12 digits is multiplied by a weight from the sequence 5 4 3 2 9 8 7 6 5 4 3 2, the products are summed, and the remainder of the division by 11 gives the digit: a remainder below 2 gives 0, otherwise 11 minus the remainder. The second digit repeats the process over 13 positions (the 12 plus the first check digit) with the weights 6 5 4 3 2 9 8 7 6 5 4 3 2.

Worked example with 00.971.255/0001-00:

First check digit, weights 5 4 3 2 9 8 7 6 5 4 3 2:

PositionCharacterValueWeightProduct
10050
20040
399327
477214
51199
622816
755735
855630
90050
100040
110030
121122

Sum = 133; 133 mod 11 = 1, so the first check digit is 0.

Second check digit: the 12 characters plus the first check digit, weights 6 5 4 3 2 9 8 7 6 5 4 3 2:

PositionCharacterValueWeightProduct
10060
20050
399436
477321
51122
622918
755840
855735
90060
100050
110040
121133
130020

Sum = 155; 155 mod 11 = 1, so the second check digit is 0. The check digits are 00.

Valid examples

Five numbers generated by the tool with a fixed seed, each one accepted by its validator:

Example (formatted)Without maskValidator
00.971.255/0001-0000971255000100valid
12.260.227/0001-5512260227000155valid
03.818.362/0001-8203818362000182valid
55.807.162/0001-2855807162000128valid
32.458.765/0001-6632458765000166valid

How the validator answers

The same first example, one with a changed ending and one truncated, checked by the validator:

ValueResultReason
00.971.255/0001-00valid-
00971255000101invalidthe check digit should be 00
009712550001invalidneeds 14 characters

Common mistakes

  • Pasting a CNPJ with the mask ("11.222.333/0001-81") into a field that wants only digits, or the other way round, is the most common reason a valid number is rejected: strip or add the punctuation first.
  • A number with all digits equal (such as 00.000.000/0000-00) passes the arithmetic of some validators but is not issued; this validator rejects it.

Frequently asked questions

Does a valid CNPJ mean the company exists?

No. The check digits only prove that the number follows the rule. To know whether a company is registered and active, query the Receita Federal.

Why does the validator accept 11.222.333/0001-81?

Because it is the textbook example: its check digits 8 and 1 follow the rule above. It is a made-up number used in documentation, not a real company.

Can I use a CNPJ number generated here in a real system?

No. A number such as 00.971.255/0001-00 has a correct format and check, but nobody was issued it, and it may coincide with a real holder by chance. Use it in test environments, demos and automated tests that never leave your control.

Report a problem