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:
| Position | Character | Value | Weight | Product |
|---|---|---|---|---|
| 1 | 0 | 0 | 5 | 0 |
| 2 | 0 | 0 | 4 | 0 |
| 3 | 9 | 9 | 3 | 27 |
| 4 | 7 | 7 | 2 | 14 |
| 5 | 1 | 1 | 9 | 9 |
| 6 | 2 | 2 | 8 | 16 |
| 7 | 5 | 5 | 7 | 35 |
| 8 | 5 | 5 | 6 | 30 |
| 9 | 0 | 0 | 5 | 0 |
| 10 | 0 | 0 | 4 | 0 |
| 11 | 0 | 0 | 3 | 0 |
| 12 | 1 | 1 | 2 | 2 |
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:
| Position | Character | Value | Weight | Product |
|---|---|---|---|---|
| 1 | 0 | 0 | 6 | 0 |
| 2 | 0 | 0 | 5 | 0 |
| 3 | 9 | 9 | 4 | 36 |
| 4 | 7 | 7 | 3 | 21 |
| 5 | 1 | 1 | 2 | 2 |
| 6 | 2 | 2 | 9 | 18 |
| 7 | 5 | 5 | 8 | 40 |
| 8 | 5 | 5 | 7 | 35 |
| 9 | 0 | 0 | 6 | 0 |
| 10 | 0 | 0 | 5 | 0 |
| 11 | 0 | 0 | 4 | 0 |
| 12 | 1 | 1 | 3 | 3 |
| 13 | 0 | 0 | 2 | 0 |
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 mask | Validator |
|---|---|---|
00.971.255/0001-00 | 00971255000100 | valid |
12.260.227/0001-55 | 12260227000155 | valid |
03.818.362/0001-82 | 03818362000182 | valid |
55.807.162/0001-28 | 55807162000128 | valid |
32.458.765/0001-66 | 32458765000166 | valid |
How the validator answers
The same first example, one with a changed ending and one truncated, checked by the validator:
| Value | Result | Reason |
|---|---|---|
00.971.255/0001-00 | valid | - |
00971255000101 | invalid | the check digit should be 00 |
009712550001 | invalid | needs 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.