The Portuguese NIF: what its nine digits tell you
A Portuguese tax number has nine digits and none of them is random. The last one is pure arithmetic, the first one is a classification fixed in law, and reading the two together tells you more than any generic validator will. This article walks through both rules from the decree-laws that set them, and it also says what the check cannot prove.
TL;DR
A NIF has nine digits: the first eight are sequential and the ninth is a control digit (article 4(1) of Decreto-Lei 14/2013). It is computed by adding the first eight digits multiplied by 9, 8, 7, 6, 5, 4, 3 and 2, dividing by 11 and subtracting the remainder from 11; if the result is 10 or 11, the digit is 0. The first digit tells you who the holder is: 1 to 4 are individuals, with a leading 45 marking a non-resident taxed only by withholding; 5, 6, 8 and 9 are NIPCs issued by the National Register of Legal Persons, which is barred from using 7; and 7 belongs to the tax authority, for undivided estates, funds and non-resident entities. The digit 0 is assigned to nobody. A correct check digit does not prove the number exists: 123456789 passes the check.
What the NIF is, in nine digits
The tax identification number is, in the words of article 2 of Decreto-Lei 14/2013, «a sequential number intended exclusively for the processing of tax and customs information, to be generated automatically»1. Sequential and automatic: the first eight digits are simply the order in which the number was issued, and they encode neither a date of birth, nor a place of birth, nor anything else about the person.
Two things, however, are not sequential. The last digit is an arithmetic check. And the first is a classification, fixed in law, of the type of holder. It is because of that second point that a Portuguese tax number is worth a closer look, and that is where most of this article goes.
The check digit, step by step
Article 4(1) says the NIF of individuals «is a number made up of nine digits, the first eight sequential and the last a control digit»1. That a control digit exists is therefore law. How it is computed is written in neither decree-law: it is the modulus-11 rule the tax authority applies, and it takes four steps.
- Multiply the first digit by 9, the second by 8, and so on until you multiply the eighth by 2. The weights are, in order, 9, 8, 7, 6, 5, 4, 3 and 2.
- Add the eight products.
- Divide the sum by 11 and keep the remainder.
- The check digit is 11 minus that remainder. If the result is 10 or 11, the digit is 0.
With 123456789 the arithmetic is short: 1×9 + 2×8 + 3×7 + 4×6 + 5×5 + 6×4 + 7×3 + 8×2 gives 156. Dividing 156 by 11 leaves 2, and 11 minus 2 is 9, which is exactly the ninth digit. The number passes the check, and it is obviously made up. Keep this case, because it is the shortest proof of something many people read backwards: a correct check digit says nothing about whether the number exists.
The fourth step has a consequence that explains something odd. Since 11 minus 0 would be 11 and 11 minus 1 would be 10, and neither is a digit, the convention uses 0 in both cases. That means 0 comes from two possible remainders while each of the other nine digits comes from just one. If it seems to you that an unusual number of Portuguese tax numbers end in zero, you are not imagining it: it is the rule.
So what is the check good for? Exactly what it was designed for: catching a transcription error. Change one digit, or swap two neighbouring digits, and the weighted sum changes, the expected check digit stops matching, and the error is obvious. That is why a form that validates the NIF before submitting it saves months of corrections.
The first digit: who the holder is
This is the information almost nobody uses. Two decree-laws split the nine digits between them, and each covers a part.
On the individual side, article 4(2) of Decreto-Lei 14/2013 says «the leftmost digit may vary between the digits 1 to 4»1. And paragraph 3 adds a fine rule that appears in almost no guide: «the leading digits 45 correspond to non-resident citizens who obtain in Portuguese territory only income subject to withholding tax on a definitive basis»1. That is not an administrative curiosity. If you are about to pay someone whose NIF starts with 45, the decree-law itself is telling you they are a non-resident whose Portuguese income is taxed by withholding. A NIF starting with 44 or 46, by contrast, belongs to an ordinary individual.
On the entity side, article 11(1) of the same decree-law says the NIF of entities covered by the National Register of Legal Persons regime «corresponds to the Legal Person Identification Number (NIPC) assigned by that body»1. And article 13(2) of Decreto-Lei 129/98 fixes that number's shape: «the NIPC is a sequential nine-digit number, the leftmost digit varying between the digits 5 and 9, excluding the digit 7»2.
Notice what those two rules settle in passing: a Portuguese company does not have a separate NIF and NIPC. It has one number, and it is the same in both roles.
The finding: the digit 7 is the seam between the two registers
Put the two rules side by side and a conclusion 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. This is not an internal practice or a statistical coincidence: article 13(2) excludes it in express words2.
And 7 is exactly what the tax authority reserves for itself. Article 11(3) of Decreto-Lei 14/2013 says «the NIF to be assigned under paragraph 2 of this article begins with the digit 7»1, and that paragraph 2 lists three cases: non-residents whose only Portuguese income is subject to final withholding, funds, and entities with obligations to the tax authority outside the register's regime. Article 16(2) repeats the same rule for undivided estates: «the NIF to be assigned begins with the digit 7»1.
The practical conclusion is strong and immediately usable: 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 with a number like that, either the number was miscopied or the entity is not what it claims to be.
The rest of the map for undivided estates is worth keeping, because that is the commonest 7 in a family's life. Article 16(1) gives exclusive competence to the tax authority, paragraph 3 says the request may be made by the head of the estate, their representative or a business manager, and paragraph 4 requires the estate's designation to contain «the name of the deceased followed by the expression head of the estate of»1. For tax purposes, an undivided estate is an entity with a number of its own.
The digit 0, and what this article does not tell you
One digit is left over, and it resolves by subtraction. Individuals occupy 1 to 4. The register has 5 to 9 without the 7. The tax authority takes the 7. That leaves 0, which neither decree-law assigns to anyone. So a number starting with 0 cannot be a NIF, even when the arithmetic works out, and it does: 000000000 has a weighted sum of zero, a remainder of zero and a check digit of zero.
There is also something you will deliberately not find here, and the reason is stated rather than implied. The finer breakdown inside the 5 to 9 range, that is what distinguishes a 5 from a 6, an 8 or a 9, is not published on this page. Article 13(3) of Decreto-Lei 129/98 provides that «the assignment of the leftmost digit is carried out in accordance with a table approved by order of the Minister of Justice»2, and that order is not readable from the primary sources we can reach. 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.
Where a wrong NIF costs money
The question «is this NIF valid?» almost always has money behind it. It is worth seeing the three places where that happens.
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»3. Both numbers, yours and the client's, and they are a mandatory element of the invoice, not an extra.
On an invoice you receive. Article 78-B(3) of the Personal Income Tax Code says «acquirers wishing to benefit from the tax credit must require the issuer to include their tax identification number on the invoices»4. And paragraph 5 explains why that is decisive: the value of the deduction «is computed by the Autoridade Tributária e Aduaneira on the basis of the invoices reported to it electronically, by the end of February of the year following their issue, in respect of each acquirer identified on them»4. If the number reported is not yours, the expense lands in someone else's e-fatura. That same paragraph 3 leaves a way out for invoices issued without a NIF: the acquirer can report them using the two-dimensional barcode, the QR code, or the unique document code.
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 applicable withholding regime. A single leading digit tells you that before anything else does.
What the check does not replace
One limit needs to be clear. This check is arithmetic and local: it runs in your browser, queries no database, and the number never leaves the page. That is an advantage in privacy and a limitation in reach. If what you need is to know whether a NIF exists, is active, and whom it belongs to, that lives in the tax authority's register and is confirmed with them, on the Portal das Finanças. What this page does, and does well, is catch the error that happens far more often: a miscopied digit.
Common mistakes
Taking a valid check digit as proof the NIF exists
The check is arithmetic and local: it confirms the nine digits are consistent with each other, nothing more. The case that settles the argument is 123456789, whose weighted sum is 156, whose remainder after dividing by 11 is 2 and whose check digit is therefore 9, the same one written. It passes the check and belongs to nobody. The taxpayer register belongs to the Autoridade Tributária, and that is where you confirm whether a number exists and is active.
Assuming a NIF starting with 7 belongs to a company
It cannot. Article 13(2) of Decreto-Lei 129/98 says the NIPC varies «between the digits 5 and 9, excluding the digit 7», so the National Register of Legal Persons is legally barred from using it. And article 11(3) and article 16(2) of Decreto-Lei 14/2013 assign that same 7 to the tax authority, for undivided estates, funds and non-resident entities.
Thinking a company has a separate NIF and NIPC
It is the same number. Article 11(1) of Decreto-Lei 14/2013 says the NIF of entities covered by the National Register of Legal Persons regime «corresponds to the Legal Person Identification Number (NIPC) assigned by that body». Nine digits, one number, the same check digit and the same validation.
Reading a leading 45 as just another pair of digits
Article 4(3) of Decreto-Lei 14/2013 gives it its own meaning: «the leading digits 45 correspond to non-resident citizens who obtain in Portuguese territory only income subject to withholding tax on a definitive basis». If you are paying someone with a NIF like that, the statute is telling you withholding tax is the applicable regime. A 44 or a 46, by contrast, is an ordinary individual.
Assuming any first digit is possible
0 is not. Put the two rules together and it follows by subtraction: individuals occupy 1 to 4, the NIPC 5 to 9 without the 7, and the tax authority the 7. Neither decree-law assigns the 0, so a number starting with 0 is not a NIF even when the check-digit arithmetic works out, as it does for 000000000.
Frequently asked questions
How do you validate a Portuguese NIF?
What does the first digit of a NIF mean?
Does a valid NIF mean it exists?
What is the difference between a NIF and a NIPC?
How do you get a NIF in Portugal?
Can one person have two NIFs?
Does a wrong NIF on an invoice cost me my tax deduction?
Why do so many Portuguese tax numbers end in zero?
Related reading & calculators
Sources
- 1.Decreto-Lei 14/2013 of 28 January: systematisation and harmonisation of the legislation on the NIF · Diário da República, 1st series, no. 19 · retrieved 19 Aug 2026
- 2.Decreto-Lei 129/98 of 13 May: legal regime of the National Register of Legal Persons, article 13 · Procuradoria-Geral Distrital de Lisboa, consolidated text · retrieved 19 Aug 2026
- 3.VAT Code, article 36: invoice deadlines and formalities · Autoridade Tributária e Aduaneira · retrieved 19 Aug 2026
- 4.Personal Income Tax Code, article 78-B: deduction of general family expenses · Autoridade Tributária e Aduaneira · retrieved 19 Aug 2026
Author / Reviewed by
Author
Thorben Rasmus Idel
Co-founder & writer
Co-founder of Calculadora Capital and the writer behind the methodology on every calculator and article. An entrepreneur and active investor, Thorben founded Idel Versandhandel GmbH, an international trading company operating across 16 countries, and invests across stocks, ETFs and cryptocurrency. He writes the methodology and verifies the math behind each page, drawing on hands-on business and investing experience to keep the tools and explanations grounded in how money, markets and taxes actually work for everyday people in Portugal.
Reviewed by
Nahar Geva
Co-founder & reviewer
Co-founder of Calculadora Capital and the independent reviewer behind every calculator and article. An entrepreneur and active investor, Nahar brings a data- and product-driven mindset together with hands-on experience in the markets, investing across stocks and ETFs as well as cryptocurrency and other digital assets, alongside broader personal finance and real estate. On each page Nahar reviews the methodology and double-checks the math and figures, pressure-testing how the tools and explanations hold up against the way money, markets and taxes actually work for everyday investors.
Published: Updated: Reviewed: