From July 2026, Brazil's company tax ID — the CNPJ — starts accepting letters. New registrations get an alphanumeric CNPJ: the first twelve positions can be digits 0-9 or uppercase letters A-Z, while the last two — the check digits — stay strictly numeric. This calculator takes those twelve positions and computes the two check digits the way Serpro and Receita Federal specify, and it shows the full working: the ASCII−48 conversion, the weights, the weighted sum, the remainder, and the rule. The canonical example, 12ABC34501DE, yields 35 — the complete CNPJ 12.ABC.345/01DE-35.
Why the CNPJ is getting letters
The CNPJ is a fourteen-position identifier administered by Receita Federal, Brazil's federal tax authority. Until now it has been purely numeric, which caps the number of distinct roots at one hundred million. That ceiling is in sight, so Instrução Normativa RFB nº 2.229/2024 introduced an alphanumeric format that multiplies the address space dramatically. The change is forward-only: it applies to new registrations from July 2026. Every existing all-numeric CNPJ stays exactly as it is and remains valid under the same rules. If you want the full timeline and migration picture, we wrote a deeper guide on what changes with the alphanumeric CNPJ.
The format: twelve alphanumeric, two numeric
The fourteen-position length does not change, and neither does the mask XX.XXX.XXX/XXXX-XX. What changes is the alphabet of the first twelve positions — the eight-position root plus the four-position branch identifier. Those twelve can now mix digits and uppercase letters. The final two positions, the verifier digits, are computed from the first twelve and are always numeric. So a valid alphanumeric CNPJ matches the pattern [A-Z0-9]{12}[0-9]{2}.
How the check digits are computed
The algorithm is the same módulo 11 scheme the numeric CNPJ already uses — the only new step is converting each character to a number. Serpro's specification is precise: the value of a character is its ASCII code minus 48. That makes '0' through '9' map to 0 through 9, exactly as before, and the letters follow on: A = 17, B = 18, … , Z = 42. Because digits map to their own value, a purely numeric CNPJ produces the identical result it always has — the alphanumeric algorithm is a strict superset.
With the twelve values in hand, the first check digit is a weighted sum using the weights 5 4 3 2 9 8 7 6 5 4 3 2 (left to right). Take that sum modulo 11; if the remainder is 0 or 1 the digit is 0, otherwise it is 11 − remainder. The second check digit appends the first to the twelve values and repeats the weighted sum with 6 5 4 3 2 9 8 7 6 5 4 3 2, applying the same remainder rule. For 12ABC34501DE the first pass sums to 459 (459 mod 11 = 8, so 11 − 8 = 3) and the second sums to 424 (424 mod 11 = 6, so 11 − 6 = 5) — check digits 35. The calculator above lays out every term so you can audit the arithmetic, not just trust it.
Backward compatibility is total
This is the reassuring part for anyone maintaining existing systems: the alphanumeric rules do not break numeric CNPJs. A classic CNPJ such as 11.444.777/0001-61 still validates, because under ASCII−48 its digits keep their plain values and the weights and remainder rule are unchanged. You do not need two algorithms — you need one algorithm that happens to accept letters. The practical work is mostly at the edges: widen the column types that store a CNPJ from numeric to text, update any ^\d{14}$ regular expression to ^[A-Z0-9]{12}[0-9]{2}$, and make sure your check-digit routine converts characters with ASCII−48 rather than parsing integers.
A note on ambiguous letters
A common question is whether every letter is allowed. The check-digit validation accepts the full A-Z range — a CNPJ containing I or O that satisfies módulo 11 is structurally valid. Separately, the technical group ENCAT recommended in Nota Técnica Conjunta 2025.001 that Receita avoid issuing the visually ambiguous letters I O U Q F (to prevent confusion with 1 and 0, and to dodge unfortunate character combinations). At the time of writing that exclusion is a recommendation pending confirmation, not a validation rule — so a validator should accept those letters, while a generator of test data does well to avoid them by default.
Who needs this, and what comes next
If you write ERP, accounting, billing, NF-e, or KYC software that touches Brazilian companies, the alphanumeric CNPJ lands in your validation layer whether you opt in or not — a new customer registered after July 2026 can have letters in their ID, and a numeric validator will wrongly reject them. The cheapest insurance is to fix the check-digit routine now and test it against valid alphanumeric samples. This calculator is the single-CNPJ tool; for checking an ID you already have, reach for a validator, and for producing batches of valid test data, a generator — both built on the same verified módulo 11 core. If you also work with the existing numeric format, the test-only CNPJ generator covers that. Everything here runs entirely in your browser: nothing you type is sent anywhere.

