Spain

Validate tax registration numbers as per Spain's validation rule. All businesses in Spain are assigned a 11 -digit global unique identifier called Spain ES VAT.

Ensure that the following details are correct for Spain ES VAT:

  • Country Code: ES

  • Validation Type: ORA_ES_VAT

  • Description: Spain ES VAT

  • Number of digits: 11

  • Format:

    'ES'+9 digits, the first or the last digit value can also be a character - e.g. ESX9999999X

    11 Characters:

    A(1-3) + N(1-7) + C(1) or

    A(1-2) + N(1-8) + C(1)

    A(1-2) = "ES"

  • Check digits: Yes, 11th digit (Last digit)

  • Check Digit Validation:

    Legal Person with Profit Aim:

    S=2#N(1)+N(2)+2#N(3)+N(4)+2#N(5)+N(6)+2#N(7)

    C(1)=10-S%10; if C=10, C=0

    Legal persons with non-profit aim

    S=2#N(1)+N(2)+2#N(3)+N(4)+2#N(5)+N(6)+2#N(7)

    C(1)=10-S%10

    C{1-10} C{A-J}

    Spanish natural persons

    C(1)=1+N(1-8)%23

    C{1-23} C{T,R,W,A,G,M,Y,F,P,D,X,B,N,J,Z,S,Q,V,H,L,C,K,E}

    Foreign natural persons, under age 14 or non-residents C(1)=1+N(1-7)%23

    C{1-23} C{T,R,W,A,G,M,Y,F,P,D,X,B,N,J,Z,S,Q,V,H,L,C,K,E}

  • Default Validation: ORA_ES_VAT

Example:

Good:

  • ESB78361482

  • ESN0071323J

  • ESP1234567D

  • ES12345678Z

  • ESK1234567L

Bad:

  • EBA12345674 (Invalid country code)

  • A12345674 (Missing country code)

  • ESA1234567 (Invalid format - too short)

  • ESA123456744 (Invalid format - too long)

  • ESP1234567E (Invalid check digit)