Portuguese NIF Validator
Type nine digits to check a Portuguese tax number, or eight to get the digit that completes it.
Type all nine digits to check a NIF, or just the first eight to get the control digit that completes them. Spaces, dots and hyphens are ignored. The arithmetic runs in your browser: the number does not leave this page.
How the result is reached
| Weights applied to the first eight digits | 9, 8, 7, 6, 5, 4, 3, 2 |
| Weighted sum | 156 |
| Remainder after dividing by 11 | 2 |
| Expected check digit | 9 |
| Check digit typed | 9 |
| First digit | 1 |
| NIF checked | 123 456 789 |
The first digit is between 1 and 4, the range article 4(2) of Decreto-Lei 14/2013 reserves for individuals.
Careful: this confirms the nine digits are consistent with each other, not that the number exists or belongs to whoever claims it. 123456789 also passes this check. The taxpayer register belongs to the Autoridade Tributária.
Educational check, not tax advice. Official confirmation that a NIF exists and is active is obtained from the Autoridade Tributária, on the Portal das Finanças.
The check digit, digit by digit
Article 4(1) of Decreto-Lei 14/2013 says the NIF is «a number made up of nine digits, the first eight sequential and the last a control digit». The first eight are simply the order in which the number was issued; the ninth is arithmetic. Multiply the first digit by 9, the second by 8 and so on until you multiply the eighth by 2, that is by the weights 9, 8, 7, 6, 5, 4, 3 and 2. Add it all up, divide by 11 and keep the remainder. The check digit is 11 minus that remainder, with one exception: if the result is 10 or 11, it is 0. That exception has a consequence worth noticing, because it explains something that looks odd: since remainders 0 and 1 BOTH produce the digit 0, that digit shows up about twice as often as any other. If it seems to you that a lot of Portuguese tax numbers end in zero, you are not imagining it.
The first digit tells you whose number it is
This is the useful part, and it comes from two decree-laws that split the nine digits between them. On the individual side, article 4(2) of Decreto-Lei 14/2013 says the first digit «may vary between the digits 1 to 4», and article 4(3) adds a fine rule almost nobody knows: the leading digits «45» belong to «non-resident citizens who obtain in Portuguese territory only income subject to withholding tax on a definitive basis». That is not a curiosity: if you are about to pay someone whose NIF starts with 45, the statute itself is telling you they are a non-resident taxed by withholding. On the entity side, article 11(1) of the same decree-law says the NIF of anyone subject to the National Register of Legal Persons IS the NIPC, and article 13(2) of Decreto-Lei 129/98 fixes it as «a sequential nine-digit number, the leftmost digit varying between the digits 5 and 9, excluding the digit 7».
The finding: the digit 7 is the seam between the two registers
Read the two rules together and something appears that we could not find published anywhere with the citations beside it. The National Register of Legal Persons is LEGALLY BARRED from using 7: article 13(2) of Decreto-Lei 129/98 fixes the NIPC as «a sequential nine-digit number, the leftmost digit varying between the digits 5 and 9, excluding the digit 7». And 7 is exactly what the tax authority reserves for itself. Article 11(3) of Decreto-Lei 14/2013 says that «the NIF to be assigned under paragraph 2 of this article begins with the digit "7"», and that paragraph 2 covers non-residents with income subject only to final withholding, funds, and entities with obligations to the tax authority outside the register’s regime. Article 16(2) repeats the rule for undivided estates: «The NIF to be assigned begins with the digit "7".» The practical conclusion is strong: a NIF beginning with 7 is never a company incorporated in Portugal. It is an undivided estate, a fund or a non-resident entity. If you receive an invoice from a supposed Portuguese company whose NIF starts with 7, something there does not add up.
What this page does not tell you, and why
Two things, and they are worth saying rather than implying. First: we do not know, and cannot know, whether the number exists. The check is arithmetic and local; the taxpayer register belongs to the tax authority, and the official lookup is done on the Portal das Finanças. Second: we do not publish the finer breakdown inside the 5 to 9 range, that is what distinguishes a 5 from a 6, an 8 or a 9. Article 13(3) of Decreto-Lei 129/98 says «the assignment of the leftmost digit is carried out in accordance with a table approved by order of the Minister of Justice», and that order is not readable from here. Lists of those correspondences circulate online, but none we can cite, and on a page about tax numbers we prefer an admitted gap to a plausible table. There is also a case the law settles by subtraction: the digit 0. Individuals occupy 1 to 4, the register 5 to 9 without the 7, the tax authority the 7. That leaves 0, which neither decree-law assigns to anyone. A number starting with 0 is not a NIF, even if the check-digit arithmetic works out.
Where a wrong NIF costs money
The question «is this NIF valid?» is almost never idle curiosity. It comes up in three places, and money is at stake in all of them. On an invoice you ISSUE: article 36(5)(a) of the VAT Code requires the invoice to contain «the names, firms or company names and the registered office or domicile of the supplier of goods or provider of services and of the recipient or acquirer who is a taxable person, as well as the corresponding tax identification numbers». On an invoice you RECEIVE: article 78-B(3) of the Personal Income Tax Code says that «acquirers wishing to benefit from the tax credit must require the issuer to include their tax identification number on the invoices», and paragraph 5 adds that the deduction is computed by the tax authority «on the basis of the invoices reported to it», so if the NIF on the invoice is wrong, the expense never reaches your e-fatura and the deduction does not exist. And on WITHHOLDING tax: a NIF beginning with 45 or 7 is the statute’s own warning that you are paying a non-resident, which changes the withholding rules.
Worked example
Type 123456789 and watch the arithmetic: 1×9 + 2×8 + 3×7 + 4×6 + 5×5 + 6×4 + 7×3 + 8×2 = 156. Divide 156 by 11 and the remainder is 2. The check digit is 11 − 2 = 9, which is exactly the ninth digit typed, so the number passes the check. And it is obviously made up. Keep this case: it is the shortest proof that a correct check digit says nothing about whether the number exists. Now change a single digit, to 123456781: the sum of the first eight does not change, the expected digit is still 9 and the 1 typed is wrong, so validation fails and the correct number would be 123456789. This is what the check digit was designed for: catching one mistyped digit, or two digits swapped, when a number is copied by hand. Finally look at the first digit: the 1 puts this number in the 1 to 4 range that article 4(2) reserves for individuals. Had it started with 5 it would be a legal person with a NIPC from the register, and had it started with 7 it would be an undivided estate, a fund or a non-resident entity.
Frequently asked questions
How do you validate a Portuguese NIF?
Does a valid NIF mean it really exists?
What does the first digit of a NIF mean?
Is a NIF starting with 7 a company?
What is the difference between a NIF and a NIPC?
Why do so many Portuguese tax numbers end in zero?
Does a wrong NIF on an invoice cost me my tax deduction?
Does this page store the number I type?
Related calculators & reading
Embed this calculator
Paste this code on your site to show the calculator. It includes an attribution link.
Preview
Sources
- Decreto-Lei n.º 14/2013, de 28 de janeiro: artigos 4.º, 11.º e 16.º (composição do NIF) · Diário da República, 1.ª série, n.º 19
- Decreto-Lei n.º 129/98, de 13 de maio: artigo 13.º (composição do NIPC) · Procuradoria-Geral Distrital de Lisboa, texto consolidado
- Código do IVA, artigo 36.º n.º 5: os elementos obrigatórios de uma fatura · Autoridade Tributária e Aduaneira
- Código do IRS, artigo 78.º-B: dedução das despesas gerais familiares · Autoridade Tributária e Aduaneira
Author: Thorben Rasmus Idel · Reviewed by: Nahar Geva · Last reviewed: 2026-08-19