Pythonic VAT validation library 🌍💳✅

Build status Documentation Status Coverage status Code style: black License: MIT PyPI


  • Offline VAT code validation using country specific regular expressions and checksum algorithms;

  • Online validation for European Union VAT codes using VIES web service;

  • VAT code sanitization;

  • Fully annotated with type hints, for a better IDE and mypy development experience;

  • Tested and validated against 1697 different VAT codes.

Getting started


vat-validator is distributed as standard pip library, and can be installed by running:

pip install vat-validator

To install the latest development version directly from git:

pip install git+git://


>>> from vat_validator import inspect_vat, sanitize_vat, vat_is_valid
>>> vat_is_valid('PT', 'PT 502 011 378')
>>> sanitize_vat('PT', 'PT 502 011 378')

To validate a VAT number with VIES web service:

>>> from vat_validator.vies import check_vat
>>> check_vat('PT', '502 011 378')
CheckVATResult(country_code='PT', vat='502011378',, 6, 8), valid=True, name='UNIVERSIDADE DO MINHO', address='LG DO PACO\nBRAGA\n4700-320 BRAGA')


These are the goals before the 1.0.0 release:

  • ❌ Have a comprehensive test suite with valid and invalid VAT codes for each country.

  • ❌ Compare the validity of each VAT code used in tests with TIN web service.

  • ✅ Remove zeep dependency, by using standard library urllib to make SOAP requests to VIES web service, making this a module without any dependencies.

  • ❌ Add support for async requests to VIES web service.


Pull requests are welcome! Please check the CONTRIBUTING file for contribution guidelines.


This software is distributed under MIT license. See the LICENSE file for details.