What is the CNPJ Validator?
CNPJ Validator is a free tool that checks whether a National Legal Entity Registration (CNPJ) number is entered correctly. Every valid CNPJ follows a strict mathematical rule imposed by the Federal Revenue Service, known as the module 11 algorithm.
Our tool applies this rule immediately: when pasting a CNPJ, it recalculates the last two numbers (the check digits) and warns whether the CNPJ is structurally true or false.
Attention: This tool only validates the mathematical structure of the number (useful for discovering typos and basic false data). It does not consult the Federal Revenue database, therefore it does not inform whether the company is active, deregistered or ineligible.
Who is it useful for?
- Developers and QA: To test registration routines, business rules in systems (ERP, e-commerce) and cleaning databases.
- Accountants and Administrative: To quickly look at a registration or invoice and see if the CNPJ provided by the client was not entered incorrectly.
- Retailers and Sellers: For quick checks on a purchase form.
How the calculation works (Module 11 Algorithm)
The CNPJ has 14 digits. The first 12 are the company root and branch order (usually 0001 or 0002). The last 2 are the check digits calculated from the first 12.
The rule works like this:
- Multiply each of the first 12 digits by a sequence of weights (5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2).
- Add all these results together and divide the sum by 11.
- The remainder of this division defines the first check digit. If the remainder is less than 2, the digit is 0; otherwise, it is 11 minus the remainder.
- The process repeats to discover the second digit, this time including the first check digit we just discovered and using a new table of weights (starting from 6).
If the numbers found in the account do not match the last two numbers entered, the CNPJ is invalid.