# stdnum.pt.nif

NIF (Número de identificação fiscal, Portuguese VAT number).

The NIF (Número de identificação fiscal, NIPC, Número de Identificação de Pessoa Colectiva) is used for VAT purposes. It is a 9-digit number with a simple checksum.

    >>> validate('PT 501 964 843')
    '501964843'
    >>> validate('PT 501 964 842')  # invalid check digits
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...

stdnum.pt.nif.calc_check_digit(number)

  Calculate the check digit. The number passed should not have the check digit included.

stdnum.pt.nif.compact(number)

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.pt.nif.is_valid(number)

  Check if the number is a valid VAT number.

stdnum.pt.nif.validate(number)

  Check if the number is a valid VAT number. This checks the length, formatting and check digit.