Alphanumeric CNPJ generator and validator

Generate and validate a alphanumeric CNPJ for tests, with the check digit algorithm shown with a worked example.

loading Alphanumeric CNPJ generator and validator
About this tool

alphanumeric CNPJ: what it is and how to test it

From July 2026 the Receita Federal issues CNPJ numbers whose first 12 positions can hold letters as well as digits, because the numeric combinations are running out. Systems that store the CNPJ as a number or a 14-digit text field need to change, and developers need valid alphanumeric samples to test them.

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

Still 14 positions: 12 of root and branch, which may be A to Z and 0 to 9, and 2 check digits, which are always numeric. The mask is the same (00.000.000/0000-00); existing numeric CNPJ keep working unchanged.

The check digit, step by step

The rule is the same module 11 as the numeric CNPJ, with one change: each character is first converted to a value equal to its ASCII code minus 48. Digits keep their value (0 to 9) and letters become 17 (A) to 42 (Z). The weights 5 4 3 2 9 8 7 6 5 4 3 2 and then 6 5 4 3 2 9 8 7 6 5 4 3 2 are applied to these values exactly as before.

Worked example with 0H.H40.VYD/BRVR-38:

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

PositionCharacterValueWeightProduct
10050
2H24496
3H24372
44428
50090
6V388304
7Y417287
8D206120
9B18590
10R344136
11V383114
12R34268

Sum = 1295; 1295 mod 11 = 8, so the first check digit is 3.

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
2H245120
3H24496
444312
50020
6V389342
7Y418328
8D207140
9B186108
10R345170
11V384152
12R343102
133326

Sum = 1576; 1576 mod 11 = 3, so the second check digit is 8. The check digits are 38.

Valid examples

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

Example (formatted)Without maskValidator
0H.H40.VYD/BRVR-380HH40VYDBRVR38valid
P0.NPC.6SU/J9HP-76P0NPC6SUJ9HP76valid
E6.7AR.C1D/MQHP-61E67ARC1DMQHP61valid
8S.F22.NLJ/96EV-088SF22NLJ96EV08valid
7I.V8Y.7WU/MP03-067IV8Y7WUMP0306valid

How the validator answers

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

ValueResultReason
0H.H40.VYD/BRVR-38valid-
0HH40VYDBRVR39invalidthe check digit should be 38
0HH40VYDBRVRinvalidneeds 14 characters

Common mistakes

  • Do not use the position of the letter in the alphabet (A = 1) as its value: the Receita uses ASCII minus 48, so A is 17. With A = 1 every sample with a letter fails the check digits.
  • Columns typed as integer, validations such as "only digits" and regular expressions like \d{14} reject the new numbers: the safe type is text of 14 characters, upper case, and the check digits are the only ones that must be numeric.

Frequently asked questions

Do old numeric CNPJ stop being valid?

No: numbers already issued stay as they are. The alphanumeric format applies to registrations made from July 2026, and the two formats coexist; the numeric rule is the particular case without letters.

Can I trust this generator for tests of my system?

For format and check digits, yes: the algorithm is the one published by the Receita Federal and the page shows the arithmetic. The numbers are not registered, so they will not pass a query to the Receita.

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

No. A number such as 0H.H40.VYD/BRVR-38 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