Understanding Foreign Tax ID Validation for Spain

Foreign companies and individuals in Spain are assigned national fiscal identification (ID) numbers (Numero de Identificacion Fiscal [N.I.F.]). These numbers are used on legal and fiscal documents, such as invoices, vouchers, and fiscal reports.

For legal entities, the system validates that the number is nine digits, does not contain any special characters, and contains the following attributes:

  • The first character is:

    • A: Corporations (sociedades anonimas).

    • B: Corporations with limited responsibility (sociedades de responsabilidad limitada).

    • C: Corporations with general partnership (sociedades colectivas).

    • D: Corporations with limited partnership (sociedades comanditarias).

    • E: Goods communities (comunidades de bienes).

    • F: Cooperative societies (sociedades cooperativas).

    • G: Associations.

    • H: Proprietary communities (comunidad de propietarios en propiedad horizontal).

    • J: Civil societies, with or without legal personality.

    • N: Foreign organizations.

    • P: Local corporations.

    • Q: Public organizations.

    • R: Rents religious congregations and institutions.

    • S: State administration bodies (organos de la administracion del estado).

    • U: Temporary unions of organizations.

    • W: Non-resident organizations.

    • K, L, M, X, Y, or Z: A type of foreign individual.

      For example, these codes might be used for a resident, non-resident, an individual who is less than 14 years old, and so on.

    • V: Other types, which are not defined in the rest of the keys.

    N represents the type of company.

  • Characters two through seven contain a numeric string.

  • The last character is a check digit that the system assigns using an algorithm that is applied to the numeric string. It can be a number or an alphabet.

When you enter address book records for Spain, you enter the N.I.F. number in the Tax ID field on the Address Book Revision form, and the system validates the number against the required format. If you enter a number in the Tax ID field that does not follow the required format, the system generates an error message.

The system validates N.I.F. when the following conditions exist:

  • The Person/Corporation code is different from 0. If the Person/Corporation code is 0, the Tax ID validation routine is not executed for the specific address book record.

  • The Special Handling Code field for the country code in the Tax ID Validation UDC table (70/TI) is 1.

  • The value in the Description 02 field in the 70/TI UDC table must be ES or ESP.