programer.tips, another cool thing from @nghuuphuoc!

vat validator

Validate VAT number

Validators

Improve it on Github

Options

Option HTML attribute Type Description
country data-bv-vat-country String An ISO-3166 country code.
It's dynamic option.
If it is not defined, it will be parsed from the VAT number
message data-bv-vat-message String The error message
When setting options via HTML attributes, remember to enable the validator by setting data-bv-vat="true".

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

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

Example

<form id="vatForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label">VAT number</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" name="vat" />
        </div>
    </div>
</form>
$(document).ready(function() {
    $('#vatForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            vat: {
                validators: {
                    vat: {
                        message: 'The VAT number is not valid'
                    }
                }
            }
        }
    });
});

Related validators

The following validators might be useful to you: