VAT numbers

VAT numbers are used in many countries for taxing purposes. In the European Union, organizations are required to use these VAT numbers when conducting intra-Community trade and e.g. for reverse charging. Although there’s no US equivalent of a VAT number, these are used in most other countries around the world.

class internationalflavor.vat_number.validators.VATNumberValidator(countries=None, exclude=None, eu_only=False, vies_check=False)

Validator for checking whether a given VAT number is valid. A VAT number starts with two characters representing the country code, followed by at least 2 characters representing the local VAT number.

  • countries – If set, the list of accepted origin countries will be limited to the provided list. Otherwise, all available VAT number countries are used.
  • exclude – You can use this parameter to exclude items from the list of countries.
  • eu_only (bool) – By default, all countries are allowed. However, if you are an EU company, you are likely to only want to accept EU VAT numbers.
  • vies_check (bool) – By default, this validator will only validate the syntax of the VAT number. If you need to validate using the EU VAT Information Exchange System (VIES) checker (see, you can set this boolean. Any VAT number in the EU VAT Area will then receive additional validation from the VIES checker, other VAT numbers will be unaffected.

The VIES check may use two different methods to obtain the result. If the suds module is installed, the VIES check uses this module to reach the VIES WSDL services (you could use the suds-jurko fork for Py3k compatibility). If this module is not available, a bare-bones native method is used instead. Both methods should give similar results, although using suds should be more reliable.


If the VIES service can not be reached, this part of the validation will succeed.


If regulations require you to validate against the VIES service, you probably also want to set eu_only. You probably can’t accept any other VAT number in that case.


All valid VAT Numbers are ISO 3166-1 country-2 codes followed by the number, except for Greece, where EL is used. You can specify GR and EL as both valid country codes, but only EL-prefixed values are accepted.


The validation of non-EU VAT numbers may be incomplete or wrong in some cases. Please issue a pull request if you feel there’s an error.

class internationalflavor.vat_number.models.VATNumberField(countries=None, exclude=None, eu_only=False, vies_check=False, *args, **kwargs)

A model field that applies the validators.VATNumberValidator and is represented by a forms.VATNumberFormField. The arguments are equal to those of the validator.


from django.db import models
from internationalflavor.vat_number import VATNumberField

class MyModel(models.Model):
    vat_number = VATNumberField(countries=['NL', 'BE'])

This field is an extension of a CharField.

class internationalflavor.vat_number.forms.VATNumberFormField(countries=None, exclude=None, eu_only=False, vies_check=False, *args, **kwargs)

A form field that applies the validators.VATNumberValidator. The arguments are equal to those of the validator.