Portuguese NIF Generator

Generate mathematically valid NIF numbers for software testing and QA — select entity type, choose quantity, and copy in one click.

First digit: 1  ·  Portuguese individual taxpayer
Quantity:
⚠️

Legal notice: Generated NIFs are mathematically valid but are not assigned to any real person or company in the Portuguese tax authority (AT) database. For software testing and QA only. Using them to misrepresent identity is illegal.

What is a Portuguese NIF?

The NIF (Número de Identificação Fiscal) is Portugal's 9-digit tax identification number, equivalent to a Tax ID or TIN in other countries. It is issued by the Portuguese Tax and Customs Authority (Autoridade Tributária e Aduaneira — AT) and is required for all economic activity in Portugal, from opening a bank account and signing a rental contract to filing a tax return or registering a company.

NIF First-Digit Reference Table

The first digit of a NIF encodes the entity type. Here is the complete reference:

First digit(s)Entity typeIssued by
1, 2, 3Portuguese individual taxpayerAT (Tax Authority)
45EU citizen without Portuguese residencyAT
5Corporation / company (NIPC)IRN / AT
6Public body or state entityAT
7Non-resident (irregular regime)AT
8Non-resident (flat-rate regime)AT
9Collective entity, non-profit, or associationAT

How the Modulo 11 Algorithm Works

The NIF is validated using a weighted checksum called Modulo 11. Here is the step-by-step process our generator uses:

Generate the first 8 digits, with the first digit set to the entity type (e.g. 1 for an individual).

Multiply each digit by a descending weight: digit 1 × 9, digit 2 × 8, digit 3 × 7 … digit 8 × 2.

Sum all the products to get a total T.

Calculate the remainder: R = T mod 11.

If R is 0 or 1, the check digit (9th digit) is 0. Otherwise, the check digit is 11 − R. (If the result is 10, use 0.)

Why Use Generated NIFs in Development?

Using real NIF numbers in staging or development environments is a GDPR violation under Article 5(1)(b) (purpose limitation) and Article 25 (data protection by design). Generated NIFs pass all format and check-digit validations, making them indistinguishable from real NIFs to any validation library — allowing you to test form logic, billing systems, tax ID fields, and fiscal documents safely.

Related Tools

Frequently Asked Questions

What is a Portuguese NIF?
A NIF (Número de Identificação Fiscal) is Portugal's 9-digit tax identification number issued by the Tax and Customs Authority (AT). The first digit encodes the entity type (1–3 for individuals, 5 for companies, 6 for public bodies, 9 for non-profits), and the ninth digit is a check digit calculated using the Modulo 11 algorithm.
How does the NIF Modulo 11 algorithm work?
Multiply each of the first 8 digits by a descending weight from 9 to 2, sum the results, take the remainder when divided by 11. If the remainder is 0 or 1, the check digit is 0; otherwise the check digit is 11 minus the remainder. Our generator applies this automatically for every NIF produced.
Are the generated NIFs real?
No. Generated NIFs pass the Modulo 11 check but are not registered in the Portuguese AT database. They belong to no real person or company and are safe for use in software testing and QA environments.
Why should I use generated NIFs instead of real ones in testing?
Using real NIF numbers in staging environments is a GDPR violation (purpose limitation and data minimisation principles). Generated NIFs pass all format and checksum validations, letting you test form logic, billing systems, and fiscal documents without exposing real personal data.
What do the first digits of a NIF mean?
1, 2, 3 = Portuguese individual. 45 = EU citizen without Portuguese residence. 5 = company/NIPC. 6 = public body. 7 = non-resident (irregular). 8 = non-resident (flat-rate). 9 = collective entity or non-profit.