Valid does not mean active
Validation only checks the math: whether the last 2 digits match the first 12. A CNPJ can be valid and be closed, irregular or not exist at all. To see the registration status, partners and address, look up the CNPJ in the Receita Federal register.
How the check digit is calculated
- Take the first 12 characters and multiply each by the weights
5 4 3 2 9 8 7 6 5 4 3 2. - Add the results and take the remainder of the division by 11.
- If the remainder is 0 or 1, the first digit is 0. Otherwise, it is 11 minus the remainder.
- Repeat with the 13 characters (including the digit you just calculated) and the weights
6 5 4 3 2 9 8 7 6 5 4 3 2to find the second digit.
In the alphanumeric CNPJ (since July 2026), letters enter the calculation as their ASCII code minus 48: A is 17, B is 18, up to Z = 42. Digits keep their own value, so existing CNPJs give the same result as always. See the alphanumeric CNPJ guide (Portuguese), with validation code in JavaScript and Python.
Validate in your system
Use the same rule in your code or call the API, which validates without using quota:
curl https://api.cnpjob.com.br/cnpj/validate/33000167000101
With a free key, GET /cnpj/:cnpj returns the full company registration. Get a free key · Documentation