idnumbers
    Preparing search index...

    The Tax Identification Number (NIF) of Portugal. This page is generated from the registry metadata of the library.

    Property Value
    Country code PRT, PT
    ID type Tax Identification Number (NIF)
    Official name Número de Identificação Fiscal (NIF)
    Also known as NIF; Número de Identificação Fiscal; Tax Identification Number
    Display format XXXXXXXXX
    Input masks #########
    Length 9
    Example 123456789
    Checksum yes
    Checksum algorithm Weighted sum mod 11 (weights 9..2)
    Parsable no

    The root entry registers every country:

    import { validateNationalId } from 'idnumbers';

    validateNationalId('PRT', '123456789').isValid; // true

    To bundle only this country, import its definition from idnumbers/countries/prt and pass it to register():

    import { register, validateNationalId } from 'idnumbers/core';
    import { country } from 'idnumbers/countries/prt';

    register(country);
    validateNationalId('PRT', '123456789').isValid; // true