CNPJ Validator

Validate CNPJ numbers (National Registry of Legal Entities) quickly and securely.

Need to generate a CNPJ for testing?

About the CNPJ Validator

The CNPJ Validator is a tool designed to verify if a National Registry of Legal Entities (CNPJ) number is mathematically valid. It applies the official Brazilian Federal Revenue algorithm to calculate the two verification digits (DV) and compares them with the provided digits.

This tool is essential for developers, testers (QAs), and system analysts who need to validate company registration logic in their software. A number validated here will pass format checks, but it is important to remember that this does not guarantee the CNPJ exists or is active in the Federal Revenue database.

Como Funciona a Validação do CNPJ?

O CNPJ tem 14 dígitos. Os dois últimos são os dígitos verificadores (DV). O cálculo é feito em duas etapas:

  1. Cálculo do Primeiro DV: Os primeiros 12 dígitos são multiplicados por uma sequência de pesos (5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2). A soma dos resultados é dividida por 11. Se o resto for menor que 2, o DV é 0. Caso contrário, o DV é 11 menos o resto.
  2. Cálculo do Segundo DV: O processo é repetido com os primeiros 13 dígitos (incluindo o primeiro DV já calculado), mas com uma nova sequência de pesos (6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2). A lógica para encontrar o segundo DV é a mesma.

Se os dois dígitos calculados corresponderem aos do CNPJ informado, ele é considerado válido.

Frequently Asked Questions (FAQ)