Skip to main content
Check Digit Calculator
Brazil

Brazilian CNPJ Checksum Validator

Validate Brazilian CNPJ check digits using two Modulus 11 calculations. Review the payload mapping and compare both control digits.

Last updated:

Government & Identity Numbers

Apply format-specific business identifier rules.

Length: 12 chars
Calculated Check Character / Checksum
--Ready
Complete Validated Sequence:
--
Arithmetic Steps & Mathematical Specification

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.

  1. 1Convert each of the first 12 characters to a value: digits 0–9, letters A = 17 … Z = 42 (ASCII code − 48).
  2. 2Multiply by weights 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 and sum.
  3. 3Set DV₁ = 0 when S mod 11 < 2, else 11 − (S mod 11).
  4. 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₂.
  5. 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.
Worked example: 11.222.333/0001-??
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)FormatBranchDVCNPJ
112223330001Numeric00018111.222.333/0001-81
000000000001Numeric00019100.000.000/0001-91
191000000001Numeric00019119.100.000/0001-91
123456780001Numeric00019512.345.678/0001-95
12ABC34501DEAlphanumeric01DE3512.ABC.345/01DE-35
A1B2C3D40001Alphanumeric000193A1.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.