What is a Portuguese NIF?
The NIF (Número de Identificação Fiscal), also known as Número de Contribuinte, is Portugal's 9-digit tax identification number. Issued by the Tax and Customs Authority (Autoridade Tributária e Aduaneira — AT), it is required for every economic or legal transaction in Portugal: opening a bank account, signing a rental agreement, registering a vehicle, filing a tax return, or issuing a fiscal invoice (fatura).
All validation runs entirely in your browser. No NIF numbers or personal data are sent to our servers. This tool validates mathematical format only — it does not check whether a NIF is currently registered with AT.
NIF First-Digit Reference — Entity Types
The first digit of a NIF identifies the type of entity it belongs to:
| First digit(s) | Entity type | Issued by |
|---|---|---|
| 1, 2, 3 | Portuguese individual taxpayer | AT |
| 45 | EU citizen without Portuguese residency | AT |
| 5 | Corporation or company (NIPC) | IRN / AT |
| 6 | Public body or state entity | AT |
| 7 | Non-resident (irregular regime) | AT |
| 8 | Non-resident (flat-rate regime) | AT |
| 9 | Collective entity, non-profit, or association | AT |
How the Modulo 11 Validation Works
Every valid NIF must satisfy the Modulo 11 checksum. Here is the step-by-step process our validator applies:
Take the first 8 digits of the NIF and assign each a weight: digit 1 gets weight 9, digit 2 gets weight 8, … digit 8 gets weight 2.
Multiply each digit by its weight and sum all products to get a total T.
Calculate the remainder: R = T mod 11.
Determine the expected check digit: if R is 0 or 1, the check digit must be 0; otherwise the check digit must equal 11 − R.
Compare the expected check digit with the actual 9th digit. If they match, the NIF is valid.
Common Reasons a NIF Fails Validation
The most frequent causes of an invalid NIF are: a transcription error (a single digit swapped or misread), an incorrect first digit (the entity type prefix does not correspond to a valid category), or a missing leading zero in NIFs starting with 0. Our validator shows the expected check digit alongside the result, helping you identify which digit needs correction.