vat validator

Validate a VAT number

Options

Using with form field

The HTML attributes are used to set the validator options via the Declarative plugin

Name HTML attribute Type Description
country* data-fv-vat___country String or Function An ISO-3166 country code
message data-fv-vat___message String The error message

The validator supports the following countries (click the sample number to validate it):

Country Abbreviation VAT system Country code Sample VAT Is it valid?
Austria UID AT ATU13585627
ATU13585626
Belgium n° TVA / BTW-nr / Mwst-nr BE BE0428759497
BE431150351
Brazil BR
Bulgaria ДДС номер BG BG175074752
BG7523169263
BG8032056031
BG7542011030
BG7111042925
BG175074753
BG7552A10004
BG7111042922
Croatia PDV-ID; OIB HR HR33392005961
HR33392005962
Cyprus ΦΠΑ CY CY10259033P
CY10259033Z
Czech Republic DIČ CZ CZ25123891
CZ7103192745
CZ991231123
CZ640903926
CZ25123890
CZ1103492745
CZ590312123
Denmark CVR DK DK13585628
DK13585627
Estonia KMKR EE EE100931558
EE100594102
EE100594103
Finland ALV nro FI FI20774740
FI20774741
France n° TVA FR FR40303265045
FR23334175221
FRK7399859412
FR4Z123456782
FR84323140391
Germany USt-IdNr. DE DE136695976
DE136695978
Greece ΑΦΜ GR GR023456780
EL094259216
EL123456781
Hungary ANUM HU HU12892312
HU12892313
Iceland VSK IS IS12345
IS123456
IS1234567
Ireland VAT no IE IE6433435F
IE6433435OA
IE8D79739I
IE8D79738J
Italy P.IVA IT IT00743110157
IT00743110158
Latvia PVN LV LV40003521600
LV16117519997
LV40003521601
LV16137519997
Lithuania PVM kodas LT LT119511515
LT100001919017
LT100004801610
LT100001919018
Luxembourg No. TVA LU LU15027442
LU15027443
Malta Vat No. MT MT11679112
MT11679113
Netherlands Btw-nr. NL NL004495445B01
NL123456789B90
Norway NO
Poland NIP PL PL8567346215
PL8567346216
Portugal NIF / NIPC PT PT501964843
PT501964842
Romania CIF RO RO18547290
RO18547291
Russia RU
Serbia RS
Slovakia IČ DPH SK SK2022749619
SK2022749618
Slovenia ID za DDV SI SI50223054
SI50223055
South Africa ZA ZA4012345678
ZA40123456789
ZA3012345678
Spain NIF / CIF ES ES54362315K
ESX2482300W
ESX5253868R
ESM1234567L
ESJ99216582
ESB58378431
ESB64717838
ES54362315Z
ESX2482300A
ESJ99216583
Sweden Momsnr. SE SE123456789701
SE123456789101
Switzerland CH
United Kingdom VAT Reg No GB GB980780684
GB802311781
Venezuela RIF VE VEJ309272292
VEV242818101
VEJ000126518
VEJ309272293
J000458323

Using with JavaScript module


// You might need to change the importing path
import vat from 'formvalidation/validators/vat';

const result = vat().validate({
    value: ...,
    options: {
        // Can be a string or a function returns a string
        country: ...,
        message: ...,
    },
});
/*
result is an object of
{
    valid: true or false,
    message: The error message
}
*/

Basic Example

You can click on sample from the table above to see if it's a valid or invalid VAT.

Module Example

The following snippet shows how to use the vat validator with JavaScript module:


// You might need to change the importing path
import vat from 'formvalidation/validators/vat';

const res1 = vat().validate({
    value: 'ATU13585627',
    options: {
        country: 'AT',
        message: 'The value is not a valid VAT number',
    },
});
// res1.valid === true

const res2 = vat().validate({
    value: 'DK13585627',
    options: {
        country: 'DK',
        message: 'The value is not a valid VAT number',
    },
});
// res2.valid === false

Related validators

The following validators are similar to this one and might be useful to you.

Name Description
id Validate an identification number