NIF Validator

Portuguese taxpayer number (NIF) — 9 digits with an official check digit.

Portugal Validation Generation

How validation works

The validator parses the 9-digit NIF, recomputes the weighted check digit and compares it with the last digit, following the rule used by the Portuguese Tax Authority.

Install the package

bash
dotnet add package DocumentNumber.Portugal.Vat.Validator

Validator in C#

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

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

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

Live example

798945320 — a real NIF value accepted by the validator

Try NIF validation

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

Document type NIF Portugal
Example: 798945320 — demo input is never stored.

Frequently asked questions

What is NIF?

Portuguese taxpayer number (NIF) — 9 digits with an official check digit.

How does NIF validation work?

The validator parses the 9-digit NIF, recomputes the weighted check digit and compares it with the last digit, following the rule used by the Portuguese Tax Authority.

How do I install the NIF validator package?

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