CNPJ.ws
Blog

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 CNPJASCII ValueValue for Check Digit Calculation
0480
1491
2502
3513
4524
5535
6546
7557
8568
9579
A6517
B6618
C6719
D6820
E6921
F7022
G7123
H7224
I7325
J7426
K7527
L7628
M7729
N7830
O7931
P8032
Q8133
R8234
S8335
T8436
U8537
V8638
W8739
X8840
Y8941
Z9042

Example:

CNPJ12ABC34501DE
Value12171819345012021

Distribute the weights from 2 to 9, from right to left (restarting after the eighth character), as shown below:

CNPJ12ABC34501DE
Value12171819345012021
Weight543298765432

Multiply the value by the weight for each column and sum all results:

CNPJ12ABC34501DE
Value12171819345012021
Weight543298765432
Product585136171242830046042

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.

CNPJ12ABC34501DE3
Value121718193450120213
Weight6543298765432
Product6106854382732350580636

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

On this page