Spain · ES
The Spanish VAT number (NIF-IVA)
Spain does not mint a new number for intra-community trade: it puts ES in
front of the NIF the company already has. What it does require is a prior registration —
and that is where almost everyone trips.
Format: ES + 9 characters (letter or digit + 7 digits + check character)
Example: ESA78374725
Issued by: the Spanish tax agency (AEAT), after registration in the ROI.
The format
A Spanish VAT number is always eleven characters including the prefix. The first and last characters of the national block may be a letter or a digit; the seven in between are always digits.
- ESThe country code, identical to the ISO code.
- AThe letter identifying the legal nature of the entity.
- 7837472Seven digits: province of registration and a sequence.
- 5The check character — a digit or a letter, depending on the entity type.
The check character is computed over the preceding seven digits. For some entities it is
always numeric (A, B, E, H), for others always a letter (N, P, Q, R, S, W), and for the rest
it can be either. When it is a letter it follows the mapping
J=0, A=1, B=2, C=3, D=4, E=5, F=6, G=7, H=8, I=9.
What the leading letter tells you
Unlike almost every other country, the Spanish number reveals the legal form at a glance. It is the only structural information it carries, and it is genuinely useful.
| Letter | Entity type |
|---|---|
A | Public limited companies (sociedad anónima) |
B | Private limited companies (sociedad limitada) |
C | General partnerships |
D | Limited partnerships |
E | Co-ownerships and undivided estates |
F | Cooperatives |
G | Associations and foundations |
H | Commonholds |
J | Civil-law partnerships |
N | Non-resident entities |
P | Local authorities |
Q | Public bodies |
R | Religious congregations and institutions |
S | Organs of the administration |
U | Temporary business consortia |
V | Other, undefined types |
W | Permanent establishments of non-resident entities |
Individuals carry no leading letter: their NIF is the DNI, eight digits
followed by a check letter, or the NIE for foreign nationals, which starts with
X, Y or Z.
CIF and NIF have been the same thing since 2008. Royal Decree 1065/2007 abolished the CIF and folded it into the NIF. The term survives in business language, but the number is identical and there is nothing to convert.
Holding a NIF is not enough: the ROI
This is the Spanish quirk that causes the most rejected invoices. A Spanish company with a perfectly valid NIF does not appear in VIES until it registers in the Register of Intra-Community Operators (ROI).
Registration is requested on form 036, ticking box 582. The tax agency may verify the business activity before granting it, and the process takes anywhere from a few days to three months. Until it clears, any European customer validating the number gets "invalid" and will charge VAT.
The practical consequence: a Spanish VAT number rejected by VIES does not mean the company does not exist. Nearly always it means the company is not in the ROI, or has been removed from it for inactivity.
Identifying the company behind the number
VIES and the AEAT lookup
The AEAT offers an intra-community operator lookup built on VIES. It confirms the number is
valid, and little else: Spain discloses neither the name nor the address through
VIES — those fields come back as ---. With Germany, Spain is one of the
two member states where validity is all Europe offers.
The Registro Mercantil
The commercial register, at registradores.org, holds the full record: company name, registered office, objects, directors and annual accounts. It can be searched by name or NIF, but the extracts are paid and there is no free bulk download. That is exactly why Spain has no open source usable at volume.
The BORME
The Official Gazette of the Commercial Register publishes registered acts — incorporations, appointments, resignations, dissolutions — for free, in a structured, downloadable format. It is a way to track changes, not to look a company up by NIF: it is not a directory.
| Source | Keyed by | What you get | Limit |
|---|---|---|---|
| VIES / AEAT lookup | VAT number | Intra-community validity only | No name, no address |
| Registro Mercantil | NIF or company name | Full record, directors, accounts | Paid, no bulk download |
| BORME | — | Registered acts, openly published | A change feed, not a directory |
Spain-specific pitfalls
- Registered with the tax agency ≠ registered in the ROI. The number one reason a Spanish VAT number fails European validation.
- The Canary Islands, Ceuta and Melilla are outside the EU VAT territory. A Canarian company has a Spanish NIF and pays IGIC instead; its supplies are not intra-community for VAT purposes.
- Removal from the ROI is silent. The tax agency can strike off an operator that stops filing recapitulative statements; the number simply stops validating, with no notice.
- Spain publishes no name or address in VIES, so there is no official, free route from a number to a company.
- The NIF never changes — not when the registered office moves, not when the company is renamed. The leading letter can change if the company converts to another legal form.
One API for 27 member states
Vatlas resolves a European VAT number to a company record: legal name, national identifier, legal form, status and address. Spain is bound by the same limit as everyone else — what a member state does not publish, nobody can return:
curl "https://api.vatlas.dev/v1/vat/ESA78374725" \
-H "Authorization: Bearer $VATLAS_KEY"
Response:
200 OK
{
"data": {
"vatNumber": "ESA78374725",
"countryCode": "ES",
"nationalNumber": "A78374725",
"nationalId": null,
"name": "",
"legalForm": null,
"status": "active",
"address": {
"line1": null,
"line2": null,
"postalCode": null,
"city": null,
"country": "ES"
}
},
"meta": {
"origin": "vies",
"source": "VIES",
"sourceUpdatedAt": "2026-08-28T09:43:47.529Z",
"checked": ["database", "VIES"]
}
}
The number is valid, meta.origin is vies, and name and address stay
empty because Spain does not publish them. We would rather say so than invent something. For
a member state with an open register, the same response is complete:
200 OK
{
"data": {
"vatNumber": "IT00743110157",
"countryCode": "IT",
"nationalNumber": "00743110157",
"nationalId": null,
"name": "MOTOROLA SOLUTIONS ITALIA SRL",
"legalForm": null,
"status": "active",
"address": {
"line1": "LARGO FRANCESCO RICHINI 6",
"line2": null,
"postalCode": "20122",
"city": "MILANO MI",
"country": "IT"
}
},
"meta": {
"origin": "vies",
"source": "VIES",
"sourceUpdatedAt": "2026-08-28T09:43:39.522Z",
"checked": ["database", "VIES"]
}
}
That is the point: one endpoint, one response shape, 27 countries. Whether
the answer came from an imported register, a national API or VIES is recorded in
meta, not branched on in your code.
Free to try. An email address creates an account — no credit card, no sales call — with 100 requests a month and a working key in about a minute.
Frequently asked
The Spanish VAT number in short
How many characters does a Spanish VAT number have?
Eleven with the prefix: ES plus nine characters, of which the first and last
may be a letter or a digit and the seven in between are always digits.
Are the CIF and the NIF the same thing?
Yes. The CIF was legally abolished in 2008 and absorbed into the NIF. The number is identical; only the name of the procedure changed.
Why does VIES say my Spanish VAT number is invalid?
Almost always because the company is not registered in the Register of Intra-Community Operators. Registration is requested on form 036, box 582, and the tax agency can take up to three months to grant it.
What does the leading letter of a NIF mean?
The legal nature of the entity: A for a public limited company, B for a private limited company, F for a cooperative, G for an association or foundation, Q for a public body, among others.
Can I get a company name from a Spanish VAT number?
Not through an official free route: Spain discloses neither name nor address via VIES, and the commercial register charges for its extracts.
Do companies in the Canary Islands have an EU VAT number?
They have a Spanish NIF, but the Canaries sit outside the EU VAT territory and are subject to IGIC instead, so their supplies are not intra-community for VAT purposes.
VAT numbers in other countries
Last updated 28 August 2026.