NIF — the 9-digit tax identification number
The NIF (Número de Identificação Fiscal) is Portugal's unique tax identifier: nine digits issued by the Autoridade Tributária (AT). Like a fiscal social-security number, it identifies every person or company in all dealings with the tax office. In e-invoicing it is the key linking issuer, acquirer, invoices and deductions.
History — from NIPC to the unified NIF
Historically, Portugal distinguished the NIF (individuals)
from the NIPC (Número de Identificação de Pessoa
Coletiva, legal persons). Both 9-digit numbers gradually converged on
a single structure, so that today "NIF" usually covers
both. With EEC accession (1986), this number became the basis of the
intra-EU VAT number (PT prefix).
The major behavioural turning point is "NIF na fatura" (2013): by asking for their NIF to appear on invoices, a consumer triggers tax deductions (IRS) and joins a tax lottery (Fatura da Sorte). This incentive massively increased the spontaneous declaration of B2C transactions, feeding the e-fatura system.
1980s | Introduction of the NIF (individuals) and NIPC (legal
| persons), two distinct 9-digit numbers.
|
1986 | EEC accession: the NIF/NIPC becomes the basis of the intra-EU
| VAT number (PT prefix + 9 digits).
|
2007-2013 | Convergence: NIF and NIPC share the same 9-digit structure;
| the NIF becomes the universal tax identifier.
|
2013 | "NIF na fatura": consumers can have their NIF printed on any
| invoice to claim tax deductions (e-fatura). A strong
| behavioural incentive.
|
2020-2023 | The NIF is embedded in the QR code (fields A issuer / B
| acquirer) and PEPPOL routing (ICD 9946).
|
2024-2026 | The NIF is the pivot of the whole apparatus: SAF-T, e-fatura,
| ATCUD, FE-AP, consumer deduction — everything revolves around
| the NIF. Governance — AT and Portal das Finanças
The NIF is assigned and managed by the Autoridade Tributária e Aduaneira via the Portal das Finanças. Non-residents and foreign entities obtain a NIF (often 9xx) for their taxable operations in Portugal, usually through a tax representative. The AT exposes validation services to verify a NIF's existence and status.
For intra-community VAT, the PT-prefixed NIF is registered in
the VIES (EU VAT Information Exchange System), enabling
cross-border validation by European partners.
Structure — prefixes and check digit
The NIF is made of 8 base digits followed by a check digit. The latter is computed by a modulo-11 algorithm with descending weights (9 to 2). The first digit indicates the entity category. The algorithm is public: it immediately catches a mistyped NIF.
--- NIF structure (9 digits) ---
N1 N2 N3 N4 N5 N6 N7 N8 C
|________________________| |
8 base digits check digit (modulo 11)
--- Prefixes by category (first digit) ---
1, 2, 3 -> individuals (residents)
5 -> legal persons (companies)
6 -> public legal persons
70, 74,75 -> inheritances, co-ownerships, etc.
9 -> non-residents / special entities
--- Check-digit computation (modulo 11) ---
sum = N1*9 + N2*8 + N3*7 + N4*6
+ N5*5 + N6*4 + N7*3 + N8*2
rem = sum mod 11
C = (rem == 0 or 1) ? 0 : 11 - rem
# Example: base 50987654 -> C = 3 -> NIF = 509876543
# For intra-EU VAT: PT509876543 NIF across the EDI / PEPPOL chain
| Context | NIF form | Example |
|---|---|---|
| SAF-T (CompanyID) | Bare NIF, 9 digits | 509876543 |
| QR code (fields A / B) | Bare NIF | A:509876543 |
| Intra-EU VAT / VIES | PT prefix + NIF | PT509876543 |
| PEPPOL EndpointID | schemeID 9946 + NIF | 9946:509876543 |
| EANCOM / EDIFACT | GLN (separate from NIF) | 5601234000005 |
Adoption — NIF na fatura
- Near-universal: every taxable person and every adult in Portugal has a NIF; it is required to open an account, sign a lease, invoice.
- NIF na fatura: consumers give their NIF en masse at checkout — the tax incentive (IRS deductions, lottery) turned B2C into a declared flow.
- Pivot of the apparatus: SAF-T, e-fatura, ATCUD, FE-AP, VAT return — everything revolves around issuer and acquirer NIF.
- Cross-border: the PT-prefixed NIF is validated via VIES by EU partners for intra-community operations.
Common pitfalls
- Invalid check digit. A NIF whose 9th digit fails the modulo-11 rule is mechanically wrong. Always validate before issuing.
- Misplaced PT prefix. SAF-T and the QR expect the bare
NIF; VIES expects
PT+ NIF. Mixing the two breaks validation. - Confusing NIF and GLN. In retail EANCOM/EDIFACT flows, logistics routing uses the GLN (GS1), distinct from the fiscal NIF. Both coexist.
- Generic "final consumer" NIF. When a customer gives no
NIF, the generic NIF
999999990is used — but not for operations requiring the real identity. - Non-resident without representative. A foreign entity must obtain a PT NIF (often via a tax representative) for its taxable operations; omitting it blocks compliant issuance.