vat validator

Validate a Spanish VAT number

Basic Example

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

Sample VAT number Is it valid?
54362315K
X2482300W
X5253868R
M1234567L
J99216582
B58378431
B64717838
R5000274J
Q5000274J
B78640570
50222711A
J99216583
54362315Z
X2482300A

Module Example

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


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

const res1 = esVat().validate('M1234567L');
// res1.valid === true

const res2 = esVat().validate('X2482300A');
// 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
vat Validate VAT number