Alphanumeric CNPJ
How to calculate the check digits of an alphanumeric CNPJ (Brazilian company registration number)
As of July 2026, the Brazilian Federal Revenue Service (Receita Federal) may issue new CNPJ registrations in an alphanumeric format (letters and numbers). Existing registrations will not be changed.
The CNPJ.ws API is already prepared for this new format and accepts queries using alphanumeric CNPJ.
Check Digit Calculation
The new alphanumeric CNPJ is composed of 14 characters, just like the current one:
- The first 12 characters are alphanumeric
- The last 2 characters are numeric check digits
The check digits are calculated from the first twelve characters in two steps, using modulus 11 and weights distributed from 2 to 9.
First Check Digit Calculation
For each CNPJ character, you must assign the value from the “Value for check digit calculation” column according to the table below, or subtract 48 from the ASCII value:
| Alphanumeric CNPJ | ASCII Value | Value for Check Digit Calculation |
|---|---|---|
| 0 | 48 | 0 |
| 1 | 49 | 1 |
| 2 | 50 | 2 |
| 3 | 51 | 3 |
| 4 | 52 | 4 |
| 5 | 53 | 5 |
| 6 | 54 | 6 |
| 7 | 55 | 7 |
| 8 | 56 | 8 |
| 9 | 57 | 9 |
| A | 65 | 17 |
| B | 66 | 18 |
| C | 67 | 19 |
| D | 68 | 20 |
| E | 69 | 21 |
| F | 70 | 22 |
| G | 71 | 23 |
| H | 72 | 24 |
| I | 73 | 25 |
| J | 74 | 26 |
| K | 75 | 27 |
| L | 76 | 28 |
| M | 77 | 29 |
| N | 78 | 30 |
| O | 79 | 31 |
| P | 80 | 32 |
| Q | 81 | 33 |
| R | 82 | 34 |
| S | 83 | 35 |
| T | 84 | 36 |
| U | 85 | 37 |
| V | 86 | 38 |
| W | 87 | 39 |
| X | 88 | 40 |
| Y | 89 | 41 |
| Z | 90 | 42 |
Example:
| CNPJ | 1 | 2 | A | B | C | 3 | 4 | 5 | 0 | 1 | D | E |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 1 | 2 | 17 | 18 | 19 | 3 | 4 | 5 | 0 | 1 | 20 | 21 |
Distribute the weights from 2 to 9, from right to left (restarting after the eighth character), as shown below:
| CNPJ | 1 | 2 | A | B | C | 3 | 4 | 5 | 0 | 1 | D | E |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 1 | 2 | 17 | 18 | 19 | 3 | 4 | 5 | 0 | 1 | 20 | 21 |
| Weight | 5 | 4 | 3 | 2 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 |
Multiply the value by the weight for each column and sum all results:
| CNPJ | 1 | 2 | A | B | C | 3 | 4 | 5 | 0 | 1 | D | E |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 1 | 2 | 17 | 18 | 19 | 3 | 4 | 5 | 0 | 1 | 20 | 21 |
| Weight | 5 | 4 | 3 | 2 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 |
| Product | 5 | 8 | 51 | 36 | 171 | 24 | 28 | 30 | 0 | 4 | 60 | 42 |
5 + 8 + 51 + 36 + 171 + 24 +28 + 30 + 0 + 4 + 60 + 42 = 459
Obtain the remainder of the division of the sum by 11.
If the remainder is 0 or 1, the first check digit is 0.
Otherwise, the first check digit is 11 − remainder.
In this example:
Remainder of 459/11 = 8, so the first check digit is 3 (result of 11-8)
Second Check Digit Calculation
To calculate the second check digit, append the first check digit to the end of the CNPJ, forming 13 characters, and repeat the same steps used for the first digit.
| CNPJ | 1 | 2 | A | B | C | 3 | 4 | 5 | 0 | 1 | D | E | 3 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 1 | 2 | 17 | 18 | 19 | 3 | 4 | 5 | 0 | 1 | 20 | 21 | 3 |
| Weight | 6 | 5 | 4 | 3 | 2 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 |
| Product | 6 | 10 | 68 | 54 | 38 | 27 | 32 | 35 | 0 | 5 | 80 | 63 | 6 |
6 + 10 + 68 + 54 + 38 + 27 + 32 + 35 + 0 + 5 + 80 + 63 + 6 = 424
Remainder of 424/11 = 6, so the second check digit is 5 (result of 11 − 6).
Final result: 12.ABC.345/01DE-35
How to automate customer registration with a CNPJ lookup API
Eliminate manual data entry when registering companies by using a CNPJ lookup API to fill in legal name, address, economic activity and tax regime automatically.
Alphanumeric CNPJ Test Example
The CNPJ.ws API is already prepared. Adapt your application calmly using this example and you'll be ready when the first alphanumeric registrations start being issued, in July 2026.