Apply format-specific business identifier rules.
Initialising algorithm engine for Brazilian CNPJ Checksum Validator...
How Brazilian CNPJ Checksum Validator Works?
The Brazilian CNPJ Checksum Validator works by computing 2 modulus 11 check digits from the first 12 characters of a Cadastro Nacional da Pessoa Jurídica (CNPJ) and comparing them with the last 2 digits. Alphanumeric CNPJs use the character value ASCII − 48.
- 1Convert each of the first 12 characters to a value: digits 0–9, letters A = 17 … Z = 42 (ASCII code − 48).
- 2Multiply by weights 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 and sum.
- 3Set DV₁ = 0 when S mod 11 < 2, else 11 − (S mod 11).
- 4Multiply the 13 values by 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 and apply the same rule for DV₂.
- 5Compare DV₁DV₂ with the last 2 digits.
Brazilian CNPJ Checksum Validator Formula
The CNPJ formula is DVₖ = 0 if (Sₖ mod 11) < 2, else 11 − (Sₖ mod 11), with format-specific character values.
v(c) = ASCII(c) − 48 (numeric: 0–9; alphanumeric: A = 17 … Z = 42) S₁ = Σ v(cᵢ) × [5,4,3,2,9,8,7,6,5,4,3,2]ᵢ S₂ = Σ v(cᵢ) × [6,5,4,3,2,9,8,7,6,5,4,3,2]ᵢ DV = 0 if S mod 11 < 2 else 11 − (S mod 11)
cᵢis the i-th CNPJ character.- Check digits stay numeric in both formats.
S₁ = 102, DV₁ = 8 S₂ = 120, DV₂ = 1 CNPJ = 11.222.333/0001-81 Alphanumeric sample 12.ABC.345/01DE-?? → DV = 35
Brazilian CNPJ Checksum Validator Conversion Table
The CNPJ conversion table lists numeric and alphanumeric CNPJ bases with their check digits.
| Base (12 characters) | Format | Branch | DV | CNPJ |
|---|---|---|---|---|
| 112223330001 | Numeric | 0001 | 81 | 11.222.333/0001-81 |
| 000000000001 | Numeric | 0001 | 91 | 00.000.000/0001-91 |
| 191000000001 | Numeric | 0001 | 91 | 19.100.000/0001-91 |
| 123456780001 | Numeric | 0001 | 95 | 12.345.678/0001-95 |
| 12ABC34501DE | Alphanumeric | 01DE | 35 | 12.ABC.345/01DE-35 |
| A1B2C3D40001 | Alphanumeric | 0001 | 93 | A1.B2C.3D4/0001-93 |
What is Brazilian CNPJ Checksum Validator?
A Brazilian CNPJ Checksum Validator is a tool that verifies the 2 check digits of a 14-character Brazilian company registration number. Digits 9–12 identify the branch (0001 is the head office).
Receita Federal introduced alphanumeric CNPJs from July 2026 to expand the number space. Existing numeric CNPJs keep their numbers, and the same formula covers both formats.
What are the uses of Brazilian CNPJ Checksum Validator?
There are 3 main uses of the Brazilian CNPJ Checksum Validator, including NF-e invoicing, supplier registration, and system migration.
- NF-e invoicing: Companies validate CNPJs on electronic invoices.
- Supplier registration: Procurement teams check supplier CNPJs.
- System migration: Developers test that systems accept alphanumeric CNPJs.