Portugal (PT)

Portuguese VAT Number Validation

Format, pattern, and MOD 11 checksum algorithm for PT VAT numbers

Portuguese VAT numbers (NIF - Número de Identificação Fiscal) consist of 9 digits with a weighted MOD 11 checksum. The first digit is a non-zero NIF category prefix.

Format vs. Active Validation

This checks format only, not if a VAT number is really registered. Use VatDB's API to verify is a number is really registered and active. VatDB checks official EU and national datasources.

Format Overview

Property Value
Country Code PT
Format 9 digits (first cannot be 0)
Length 9 digits
Example PT123456789

Regex Pattern

^PT[1-9][0-9]{8}$

First Digit Prefixes (high level)

Prefix Category (high level)
1-4 Individual-person NIF ranges (different categories)
5 Company/legal-entity prefix (common corporate range)
6 Public entities
7 Other entities
8-9 Special / non-resident / other assigned ranges

Checksum Algorithm (MOD 11)

def validate_pt_vat(number):
    if number.startswith('PT'):
        number = number[2:]

    if len(number) != 9 or not number.isdigit():
        return False

    if number[0] == '0':
        return False

    weights = [9, 8, 7, 6, 5, 4, 3, 2]
    total = sum(int(d) * w for d, w in zip(number[:8], weights))
    check = 11 - (total % 11)

    if check >= 10:
        check = 0

    return check == int(number[8])

Frequently Asked Questions

How do I verify a Portuguese VAT number (NIF)?
Portuguese VAT numbers use weighted MOD 11 with weights [9,8,7,6,5,4,3,2]. If check >= 10, it becomes 0. Use VatDB's API for official verification against EU and national databases.
What does a Portuguese VAT number look like?
A Portuguese VAT number (NIF) has the format PT123456789 - 'PT' followed by exactly 9 digits. The first digit cannot be 0 because NIFs use non-zero category prefixes.
How many digits are in a Portuguese VAT number?
A Portuguese VAT number contains exactly 9 digits after the PT country code. The complete number is 11 characters: PT + 9 digits.
What is a Portuguese NIF number?
NIF (Número de Identificação Fiscal) is the Portuguese Tax Identification Number. It's the 9-digit number used as both personal tax ID and company VAT number.
What does the first digit of a Portuguese NIF mean?
The first digit is a non-zero NIF category prefix. In practice, prefixes 1-4 cover individual-person ranges, while 5-9 are used for entity/special/non-resident categories depending on the assigning system.
Where can I check a Portuguese company's VAT number?
VatDB's API validates VAT numbers against official EU and national databases in real-time. Includes company details with each verification.
What's the difference between format validation and checking if a VAT number is active?
Format validation verifies correct structure, but can't confirm actual registration. Numbers might be deactivated or never issued for VAT purposes. VatDB provides live status.

Validate Portuguese VAT Numbers Instantly

Use our API for real-time PT VAT number validation

Try Free