Skip to content
Alphanumeric CNPJ: what changes and how to validate it
Help · Data

Alphanumeric CNPJ: what changes and how to validate it

Alphanumeric CNPJ, issued since July 2026: the format with letters, the regex, how to calculate the check digits and how to store and compare it.

Anatomy of a CNPJ XX.XXX.XXX/XXXX-XX

An alphanumeric CNPJ may have letters, as well as digits, in its first 12 positions. CNPJs already issued do not change, both formats coexist, and CNPJá accepts both on the platform and in the API.

What changes

In July 2026, the Receita Federal started issuing CNPJs with letters for new registrations, to expand the number of possible registrations, under Instrução Normativa RFB nº 2.229 of 15 October 2024.

Only the set of characters accepted in the root and in the establishment order changes: they now admit uppercase letters from A to Z. The 14-character length, the mask, the two numeric check digits and every CNPJ already issued stay the same: an existing company keeps the CNPJ it has.

Format

The CNPJ still has 14 characters and the mask XX.XXX.XXX/XXXX-XX. The first 12, which make up the root (8) and the establishment order (4), may be digits from 0 to 9 or uppercase letters from A to Z. The last 2, the check digits, are always digits.

The Receita Federal illustrates the format with 12.ABC.345/01DE-35: root 12.ABC.345, order 01DE and check digits 35. Without the mask, the same CNPJ is 12ABC34501DE35.

To check whether a text with no punctuation has the shape of a CNPJ, use the pattern ^[0-9A-Z]{12}[0-9]{2}$. It checks the shape only; the check digits confirm the rest.

Check digits

The check digits are still computed with modulo 11, now using the value of each character: its ASCII code minus 48. Digits keep their own value, from 0 to 9, and letters are worth 17 (A) to 42 (Z). Since digits are worth the same as before, the same calculation validates numeric and alphanumeric CNPJs.

  1. Multiply the value of each of the first 12 characters by the weights 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3 and 2, in order, and add up the results.
  2. Divide the sum by 11. If the remainder is 0 or 1, the first digit is 0; otherwise, it is 11 minus the remainder.
  3. Repeat the calculation with the first 13 characters, now ending with the first digit, and the weights 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3 and 2. The result is the second digit.

In the example 12ABC34501DE, the values are 1, 2, 17, 18, 19, 3, 4, 5, 0, 1, 20 and 21. The first sum is 459, with remainder 8, so the first digit is 3. The second sum, with the 3 at the end, is 424, with remainder 6, so the second digit is 5: 12ABC34501DE35.

The same rule in JavaScript, which strips punctuation and uppercases letters before checking:

function cnpjDigit(base) {
  const weights = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2].slice(-base.length);
  const sum = [...base].reduce((total, char, index) => total + (char.charCodeAt(0) - 48) * weights[index], 0);
  return String(sum % 11 < 2 ? 0 : 11 - (sum % 11));
}

function isCnpj(value) {
  const cnpj = value.toUpperCase().replace(/[^0-9A-Z]/g, '');
  return (
    /^[0-9A-Z]{12}[0-9]{2}$/.test(cnpj) &&
    !/^0+$/.test(cnpj) &&
    cnpj[12] === cnpjDigit(cnpj.slice(0, 12)) &&
    cnpj[13] === cnpjDigit(cnpj.slice(0, 13))
  );
}

A run of 14 zeros passes the check digit calculation but is not a CNPJ, so the function rejects it.

How to type, store and compare

Always store the CNPJ as text, with 14 characters. A numeric field loses the letters of an alphanumeric CNPJ and the leading zeros of CNPJs that start with zero.

To compare two CNPJs, strip the punctuation and uppercase the letters first: 12.abc.345/01de-35 and 12ABC34501DE35 are the same CNPJ. To tell whether two establishments belong to the same company, compare the first 8 characters of the result, the root.

Validations that accept digits alone reject valid CNPJs. Review form masks, column types in databases and spreadsheets, regular expressions and integrations that treat the CNPJ as a number.

In spreadsheets, format the CNPJ column as text before pasting or importing. Excel drops the leading zeros of numbers, and the CNPJá CNPJ field puts back up to two of them, as explained in Leading zeros and Excel. The rules for every identifier are in Data formats.

Where it appears in the app

The platform accepts the alphanumeric CNPJ wherever a CNPJ is typed, with uppercase or lowercase letters, which it uppercases:

  • in global search, with Ctrl+K (⌘K on a Mac), with or without punctuation: a complete CNPJ opens the record page right away;
  • in the address of the record page, /establishments/ followed by the CNPJ with no punctuation, because the slash of the mask breaks the address;
  • in the CNPJ root filter of Search CNPJs;
  • in the CNPJ field of lists and bulk lookup, with or without punctuation, when typing, pasting or loading a file, as explained in Import CNPJs from Excel, CSV or text;
  • in the organization’s billing details, at checkout and in Settings > General.

On the record page, the letters of the CNPJ are highlighted. A CNPJ with wrong check digits shows Invalid check digits instead of the record, as explained in When a record won’t open.

In the API

The operations accept both formats: send the CNPJ in taxId, with 14 characters, and the root with 8, with no punctuation and with uppercase letters. Responses return taxId and company.id in the same format. A CNPJ out of format or with invalid check digits is rejected, and the cases of each operation are in CNPJ lookup in the API.

Informational content that may change without notice. It is not tax, accounting or legal advice, and CNPJá's terms and policies prevail over this page.