Portugal NIF Generator
Generate valid Portuguese NIF (Tax Identification Number) for QA testing.
About Tax Identification Number (NIF)
The Tax Identification Number (NIF), commonly referred to as the Contributor Number in Portugal, is the unique nine-digit numeric identifier assigned by the Tax and Customs Authority (AT) to individuals and corporate entities for tax purposes.
This tool generates simulated and mathematically valid Portuguese taxpayer numbers (NIF). The generator separates entity types: Individuals (initial prefixes 1, 2, 3) and Companies/Corporate entities (prefixes 5, 6, 8, 9), calculating check digit using Modulo 11.
Anatomy & Structure of Portuguese NIF
The Tax Identification Number (NIF) consists of 9 digits issued by AT:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 | Prefix / Category | 1 digit | Taxpayer category (1/2/3 Individual, 5 Company, 6 Public Body, 8 Sole Trader, 9 Funds) | 5 |
| 2 to 8 | Sequential | 7 digits | Sequential identifier assigned by the Tax Authority (AT) | 0123456 |
| 9 | Check Digit | 1 digit | Weighted checksum digit calculated with Modulo 11 and weights 9 to 2 | 7 |
NIF Validation Algorithm (Weighted Modulo 11)
The Tax Authority calculates the check digit using descending weights from 9 to 2:
- 1. Multiply first 8 digits by weights [9, 8, 7, 6, 5, 4, 3, 2].
- 2. Compute sum of products.
- 3. Calculate remainder modulo 11: Remainder = Sum % 11.
- 4. Preliminary check digit: DV = 11 - Remainder.
- 5. If DV is 10 or 11, set DV = 0; otherwise use the calculated number.
Frequently Asked Questions (FAQ)
Can these generated NIF numbers be used for real purposes?
No. All generated NIFs are mock numbers for academic tests or software staging and ERP testing. Real-world usage is strictly prohibited.
What do NIF prefixes represent?
The first digit of the NIF defines the nature of the tax registration. For example, prefixes starting with 5 strictly represent companies.