Generate valid CNPJ numbers for software testing and validate any CNPJ instantly.
The CNPJ (Cadastro Nacional da Pessoa Jurídica) identifies companies in Brazil. It has 14 positions: an 8-position root that identifies the company, a 4-position suffix for the branch (0001 for the headquarters), and two check digits computed with the modulo 11 algorithm. This generator produces numbers that pass that validation, which is what a developer needs to test company registration forms, invoicing systems and ERP integrations.
Like the CPF generator, everything here is random: the generated CNPJ is not looked up in any registry and does not correspond to any real company. The tool guarantees only that the math checks out — enough for any correctly implemented validation to accept it in a test environment, and no more than that. Using generated documents outside of testing may constitute fraud.
The validator also understands the alphanumeric CNPJ, the format Brazil started issuing to new registrations in July 2026. In it, the 12 first positions may contain letters, and the check-digit math uses each character's ASCII value minus 48. The generator produces the classic all-numeric format, which remains valid and is what most test suites expect.
Check digits: multiply the first 12 positions by weights 5,4,3,2,9,8,7,6,5,4,3,2 and take the remainder of the division by 11; if the remainder is 0 or 1 the digit is 0, otherwise 11 minus the remainder. Repeat with weights 6,5,4,3,2,9,8,7,6,5,4,3,2 including the first check digit. For alphanumeric CNPJs, each character contributes its ASCII value minus 48.
No. It is a random number that only satisfies the check-digit math. It is not registered with the Receita Federal and does not belong to any company.
The first 8 positions identify the company (the "root"), the next 4 identify the branch — 0001 is the headquarters — and the last 2 are check digits.
Since July 2026 new Brazilian registrations can receive CNPJs with letters in the first 12 positions. The check-digit algorithm is the same, using each character's ASCII value minus 48. The validator here accepts both formats.
No. Generated documents are for software testing only. Using them on real services may constitute fraud, which is a crime.
No. Generation and validation run 100% in JavaScript on your device. Nothing is transmitted or stored.
Vai.la turns any URL into a short link with click statistics, QR Code and your own biolink.
Vai.la is not responsible for how the tools are used or for decisions made based on their results.