CPF / CNPJ Validator

Brazilian taxpayer identifiers — CPF (11 digits) and CNPJ (14 digits).

Brazil Validation Generation

How validation works

The validator applies the weighted check-digit algorithm of the Receita Federal to both CPF and CNPJ numbers.

Install the package

bash
dotnet add package DocumentNumber.Brazil.Vat.Validator

Validator in C#

Program.cs
using DocumentNumber.Brazil.Vat.Validator;

var validator = new VatValidator();
var isValid = validator.Validate("24911211903");

Console.WriteLine(isValid ? "Valid" : "Invalid");

Live example

24911211903 — a real CPF / CNPJ value accepted by the validator

Try CPF / CNPJ validation

Runs the exact same library code your application uses. Nothing you enter is stored.

Document type CPF / CNPJ Brazil
Example: 24911211903 — demo input is never stored.

Frequently asked questions

What is CPF / CNPJ?

Brazilian taxpayer identifiers — CPF (11 digits) and CNPJ (14 digits).

How does CPF / CNPJ validation work?

The validator applies the weighted check-digit algorithm of the Receita Federal to both CPF and CNPJ numbers.

How do I install the CPF / CNPJ validator package?

dotnet add package DocumentNumber.Brazil.Vat.Validator

Is the value I enter in the demo stored?

No. Demo inputs are processed in memory for the current request only and are never persisted or shared.

Related document types