Skip to content
Calculadora Capital

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.

Validation
Valid NIF
Type of holder
Individual

How the result is reached

Weights applied to the first eight digits9, 8, 7, 6, 5, 4, 3, 2
Weighted sum156
Remainder after dividing by 112
Expected check digit9
Check digit typed9
First digit1
NIF checked123 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?
A Portuguese NIF has nine digits and the last one is a control digit computed from the first eight. Multiply them by the weights 9, 8, 7, 6, 5, 4, 3 and 2, add them up, divide by 11 and subtract the remainder from 11: that is the check digit, and if the result is 10 or 11 then it is 0. If the ninth digit typed matches the one computed, the number passes. It is also worth checking the first digit, because only 1 to 9 are assigned: 1 to 4 to individuals, 5 to 9 without the 7 to legal persons, and the 7 to the tax authority. Type the number above and the page does the arithmetic and shows every step.
Does a valid NIF mean it really exists?
No, and this is the most important confusion to clear up. The check digit only verifies that the nine digits are internally consistent, which catches a typo but not a deliberate invention. The clearest example is 123456789: the weighted sum is 156, the remainder of dividing by 11 is 2, the check digit is 9, and so the number passes the check without belonging to anyone. The taxpayer register belongs to the Autoridade Tributária, and official confirmation that a NIF exists and is active is obtained from them, on the Portal das Finanças. This page does arithmetic, not a register lookup.
What does the first digit of a NIF mean?
It tells you who the holder is, and it is fixed in law. Digits 1 to 4 belong to individuals (article 4(2) of Decreto-Lei 14/2013), with the particularity that the leading digits «45» belong to non-resident citizens whose only Portuguese income is subject to final withholding tax (article 4(3)). Digits 5, 6, 8 and 9 belong to legal persons and correspond to the NIPC issued by the National Register of Legal Persons, which under article 13(2) of Decreto-Lei 129/98 uses the 5 to 9 range «excluding the digit 7». And the 7 belongs to the tax authority: undivided estates, funds and non-resident entities. The digit 0 is assigned to nobody.
Is a NIF starting with 7 a company?
It cannot be, and this is the most useful reading of all. The National Register of Legal Persons is expressly barred from using 7 by article 13(2) of Decreto-Lei 129/98, and the tax authority reserves it for the cases it assigns itself: undivided estates (article 16(2) of Decreto-Lei 14/2013) and the entities of article 11(2), that is non-residents with income subject only to final withholding, funds, and entities with obligations to the tax authority outside the register’s regime (article 11(3)). So if you receive an invoice from a supposed Portuguese company whose NIF starts with 7, either the number was miscopied or the entity is not what it claims to be.
What is the difference between a NIF and a NIPC?
They are the same number seen from two sides. The NIPC is the number the National Register of Legal Persons assigns to an entity when it enters it in the central file of legal persons, and article 11(1) of Decreto-Lei 14/2013 says the NIF of those entities «corresponds to the Legal Person Identification Number (NIPC) assigned by that body». So a Portuguese company does not have a separate NIF and NIPC: it has one nine-digit number, with the same check digit and the same validation. What differs is who assigns it, which is why entities outside the register’s regime, estates, funds, non-residents, get their number straight from the tax authority, in the 7 range.
Why do so many Portuguese tax numbers end in zero?
Because of a detail in the rule. The check digit is 11 minus the remainder of dividing by 11, but 11 minus 0 would be 11 and 11 minus 1 would be 10, and neither is a digit. The convention resolves both cases the same way, making the digit 0. That means two different remainders, 0 and 1, produce the same check digit, while each of the other nine digits comes from a single remainder. The result: 0 appears as a check digit about twice as often as any other digit. It is not a pattern in the numbers issued, it is arithmetic in the rule itself.
Does a wrong NIF on an invoice cost me my tax deduction?
It can, yes. Article 78-B(3) of the Personal Income Tax Code is explicit: «acquirers wishing to benefit from the tax credit must require the issuer to include their tax identification number on the invoices.» Paragraph 5 adds that the value of the deductions «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». If the reported NIF is not yours, the expense is attributed to someone else and never appears in your e-fatura. That same paragraph 3 offers a way out for invoices issued without a NIF: the acquirer can report them personally using the QR code or the unique document code.
Does this page store the number I type?
No. The check runs entirely in your browser, with the arithmetic described above, and the number is not sent to any server or saved anywhere. That is a consequence of how the page is built rather than a policy: there is nothing here that queries a database, because the check-digit arithmetic does not need one.

Related calculators & reading

Embed this calculator

Paste this code on your site to show the calculator. It includes an attribution link.

Language
Theme
Colour

Preview

Free to use. The code auto-adjusts its height.

Sources

Author: Thorben Rasmus Idel · Reviewed by: Nahar Geva · Last reviewed: 2026-08-19