Cadastro Nacional da Pessoa Jurídica
Brazil · Companies
Paste or type the number — punctuation is optional.
Other identifiers
Europe
Asia and the Middle East
Oceania
What this check does — and what it cannot do
This tool checks the number's structure and its check digit, using the published algorithm for that document. A number that passes is well formed: it is arithmetically consistent and could have been issued.
It cannot tell you whether the number was actually issued, whether it is active, or who it belongs to. Only the issuing tax authority can confirm that, through its own lookup service. Treat a passing result as "worth submitting", never as proof of identity.
The generator produces numbers that satisfy the same checksum, for filling forms while developing and testing software. They are arithmetic, not records: they are not drawn from any register and do not correspond to a real holder. No generator is offered for the US Social Security Number.
Two check digits cut the false-pass rate from 1 in 10 to 1 in 100
The Brazilian CNPJ ends in two check digits rather than one, and the second is computed over the first. That single design decision takes the chance of a random fourteen-digit string passing from roughly 10% down to 1% — measured at 0.96% over a hundred thousand trials. It is the difference between a checksum that filters and one that barely narrows.
How it works
- Validates the fourteen-digit CNPJ by recomputing both check digits with the mod-11 weighting.
- Handles the branch identifier, which changes the check digits even for the same company.
- Is explicit that arithmetic validity is not proof of registration.
first digit: weights 5 4 3 2 9 8 7 6 5 4 3 2 over the 12 base digits
second digit: weights 6 5 4 3 2 9 8 7 6 5 4 3 2 over 12 base digits + first check digit
both: remainder = sum mod 11
digit = 0 if remainder < 2, else 11 − remainder
layout: NN.NNN.NNN/BBBB-DD where BBBB is the branchWorked example
Deriving the check digits for a base number, then changing only the branch.
- base 11.222.333/0001
- first check digit → 8
- second check digit, computed over the first → 1
- complete: 11.222.333/0001-81
- same company, branch 0002 → check digits 62
Changing the branch from 0001 to 0002 changes the check digits from 81 to 62. The suffix is not decoration attached to a company — it is computed over the whole number including the branch, so head office and each branch carry different check digits.
Reading the result
- The measured false-pass rate is 0.96%, essentially the 1% the design predicts. That is ten times better than a single check digit and still means one random string in a hundred looks valid, so the checksum is a filter and not an identity proof.
- 0001 is conventionally the head office and higher numbers are branches. Because each branch produces its own check digits, a system that stores the base and the branch separately must recompute rather than reuse the suffix.
- Mod-11 needs a rule for the remainder-of-1 case, and CNPJ resolves it by emitting 0. Other national schemes handle the same collision differently — the Chilean RUT emits the letter K — which is why mod-11 validators are not interchangeable across countries.
- As with any checksum, passing means the digits are internally consistent. Confirming a company actually exists and is active requires the Receita Federal register, which is also the only place to check its trading status.
Common questions
- Why does the CNPJ have two check digits when most identifiers have one?
- To cut the false-pass rate by a factor of ten. One digit lets roughly 1 in 10 random strings through; two lets through 1 in 100, measured here at 0.96%. The second digit is computed over the first, so it also catches errors in the first digit itself.
- Do branches of the same company share a CNPJ?
- They share the first eight digits and differ in the four-digit branch, which changes the check digits. 11.222.333/0001-81 and 11.222.333/0002-62 are the same company, and neither suffix can be guessed from the other.