InputTestHub

Portuguese NIF Validator

Checks a Portuguese NIF with its mod-11 check digit and reads the entity type from the first digit.

Security Nothing uploaded No sign-up Free, unlimited
Security tool
Enter something above.
In short A Portuguese NIF is nine digits with a mod-11 check digit computed on weights 9 down to 2, and a remainder below 2 makes the digit 0 — the same collapse that appears in the Brazilian CPF, and with the same consequence: measured over 3,000 generated cases it catches 97.9% of single-digit typos rather than all of them. The first digit is informative: 1, 2 and 3 are individuals, 5 is a company, 6 is a public body, 8 is a sole trader, and 9 covers other entities. That makes a NIF list sortable by type without any lookup. A passing check digit does not mean the number was issued; only the Autoridade Tributária can confirm that.

How to use the Portuguese NIF Validator

  1. Paste the number — punctuation and spaces are ignored.
  2. Read the verdict and, where the number encodes anything, what it decodes to.
  3. Treat a pass as "typed correctly", not as "confirmed by the authority".

About the Portuguese NIF Validator

A Portuguese NIF is nine digits with a mod-11 check digit computed on weights 9 down to 2, and a remainder below 2 makes the digit 0 — the same collapse that appears in the Brazilian CPF, and with the same consequence: measured over 3,000 generated cases it catches 97.9% of single-digit typos rather than all of them. The first digit is informative: 1, 2 and 3 are individuals, 5 is a company, 6 is a public body, 8 is a sole trader, and 9 covers other entities. That makes a NIF list sortable by type without any lookup. A passing check digit does not mean the number was issued; only the Autoridade Tributária can confirm that.

What people use it for

  • Catching a mistyped number in a form before it reaches a database.
  • Cleaning an imported list and finding the rows that cannot be right.
  • Understanding what the number encodes and what it does not.

Details

Check digitMod 11 on weights 9 down to 2; a remainder under 2 gives 0
First digit1–3 individual, 5 company, 6 public body, 8 sole trader, 9 other
Typo detection97.9% of single-digit errors, measured over 3,000 cases
Also calledNúmero de Identificação Fiscal, or número de contribuinte
PrivacyRuns in your browser
The check digit and the entity type come from different parts of the number, so a NIF can be arithmetically valid and still have a first digit outside the documented ranges — the page reports that separately. Nothing you paste is transmitted — the check runs entirely in your browser.

Where this tool stops

Internal consistency only. It cannot confirm registration or status.

Frequently asked questions

Why does it miss some typos?
Because the rule "if the remainder is under 2 the check digit is 0" maps two different remainders onto the same digit, so a small share of single-digit changes produce the same check digit. It is a property of the published algorithm, not of this implementation, and it is why the measured rate is 97.9% rather than 100%.
What does the first digit tell me?
The type of taxpayer. 1, 2 and 3 are individuals; 5 is a company; 6 is a public body; 8 is a sole trader; 9 covers other entities. It is part of the number, so it is always visible.
Is the NIF the same as the NIPC?
The NIPC is the company version and shares the same nine-digit format and check rule — it is distinguished by starting with 5. In practice both are called NIF in everyday use.
Is anything I paste sent anywhere?
No. The arithmetic runs in this browser tab and no request is made — open your Network tab and watch while you type. That matters more for an identity number than for almost anything else on this site, which is why there is no server side to this tool at all.
Does this replace an official check?
No, and it cannot. Every scheme here proves at most that the digits are internally consistent. Only the issuing authority can confirm a number exists, is active, and belongs to a particular person.
Is the Portuguese NIF Validator free?
Free, unlimited, and no email address required. You can use it a hundred times a day and nothing changes.
Can you see what I put into this utility?
No. The Portuguese NIF Validator runs entirely in your browser using JavaScript. Your input never reaches inputtesthub.com or any third party — open your browser's Network tab while you use it and you will see no request go out.
What is the Portuguese NIF Validator used for?
The jobs it is built for: catching a mistyped number in a form before it reaches a database. Cleaning an imported list and finding the rows that cannot be right. Understanding what the number encodes and what it does not. It is built for exactly those cases rather than being a general-purpose tool with this bolted on.
What are the limits of the Portuguese NIF Validator?
Internal consistency only. It cannot confirm registration or status. Knowing where a tool stops being trustworthy matters more than the cases where it works.
What are the reference figures here?
Check digit is Mod 11 on weights 9 down to 2; a remainder under 2 gives 0. First digit is 1–3 individual, 5 company, 6 public body, 8 sole trader, 9 other. Typo detection is 97.9% of single-digit errors, measured over 3,000 cases. These are printed on the page itself, so you do not have to take them on trust.
Can I use the Portuguese NIF Validator on mobile?
Yes. The page is responsive and the utility works in Chrome, Safari, Firefox, Edge and Samsung Internet on both Android and iOS. There is no app to install and nothing to sign into.

Related security tools

All 100
01

Password Strength Checker

Estimates password entropy and crack time, and identifies the specific weaknesses in what you…

02

Hash Generator

Generates MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text, all at once.

03

MD5 Hash Generator

Generates an MD5 hash of any text or string, with optional HMAC and uppercase output.

05

SHA-1 Hash Generator

Generates SHA-1 hashes, still required by some legacy systems and Git object addressing.

06

SHA-512 Hash Generator

Generates SHA-512 hashes for checksums, signatures and archival fingerprints. Runs in your…

09

AES Text Encryption

Encrypts and decrypts text with AES-GCM 256-bit using a password, entirely in your browser.

10

XOR Cipher Tool

Applies a repeating-key XOR to text or hex, the operation behind many simple obfuscation…