NIF Generator

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

Portugal Validation Generation

How generation works

The NIF generator builds a structurally valid sample using the same rules the validator enforces — check digits included. Use it for test data and fixtures; never for production records.

Install the package

bash
dotnet add package DocumentNumber.Portugal.Vat.Generator

Generator in C#

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

var generator = new VatGenerator();
var sample = generator.GenerateDocumentNumber();

Console.WriteLine(sample);

Live example

798945320 — a real NIF value accepted by the validator

Try NIF generation

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 generation work?

The generator builds a structurally valid NIF sample using the same rules the validator enforces — including check digits. Generated values are intended for tests and development only.

How do I install the NIF generator package?

dotnet add package DocumentNumber.Portugal.Vat.Generator

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