DNI / NIE / CIF Validator

Spanish tax identifiers — DNI, NIE and CIF with their official check digits.

Spain Validation Generation

How validation works

The validator identifies the document kind (DNI, NIE or CIF) and recomputes the matching check character: a letter for DNI/NIE, a control digit or letter for CIF.

Install the package

bash
dotnet add package DocumentNumber.Spain.Vat.Validator

Validator in C#

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

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

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

Live example

49365682T — a real DNI / NIE / CIF value accepted by the validator

Try DNI / NIE / CIF validation

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

Document type DNI / NIE / CIF Spain
Example: 49365682T — demo input is never stored.

Frequently asked questions

What is DNI / NIE / CIF?

Spanish tax identifiers — DNI, NIE and CIF with their official check digits.

How does DNI / NIE / CIF validation work?

The validator identifies the document kind (DNI, NIE or CIF) and recomputes the matching check character: a letter for DNI/NIE, a control digit or letter for CIF.

How do I install the DNI / NIE / CIF validator package?

dotnet add package DocumentNumber.Spain.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