Skip to content

vat

Validates a VAT (Value Added Tax) number for one of 38 supported countries.

Options

OptionTypeDefaultDescription
countrystringundefinedISO 3166-1 alpha-2 country code (e.g. "DE", "BR", "FR")
messagestringlocale defaultCustom error message

Playground

Valid values

CountryValueNotes
DE"DE123456789"German USt-IdNr
BR"11222333000181"Brazilian CNPJ
FR"FR40303265045"French TVA
GB"GB980780684"UK VAT

Invalid values

ValueCountryReason
"DE000000000"DEFails weighted checksum
"FR00000000000"FRInvalid key digits

Notes

  • Empty string ("") always returns valid: true. Combine with notEmpty to require a value.
  • Unknown or omitted country returns valid: true (pass-through).
  • Supported countries: AR, AT, BE, BG, BR, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IS, IT, LT, LU, LV, MT, NL, NO, PL, PT, RO, RS, RU, SE, SI, SK, VE, ZA.

Released under the MIT License.