TaxDo
Back to Tax ID Guides

Spain Tax ID Number (TIN) Check: How to Verify a NIF, NIE or ES VAT Number

Updated On November 13, 2026
11 minutes Read

Sources last verified: 28 October 2026

Official sources cited at the end of this page.

Every EU Member State answers for its VAT numbers through VIES, the European Commission’s validation service, and Spain’s answer is its TIN number with ES in front. That number is the NIF (número de identificación fiscal), administered by the Agencia Estatal de Administración Tributaria (AEAT). It is eight digits and a check letter for Spaniards (the DNI), X, Y or Z, seven digits and a letter for foreigners (the NIE), and a letter, seven digits and a control character for companies.

Spain then works the shared framework its own way: a Spanish NIF shows as valid in VIES only once its holder joins the Registro de Operadores Intracomunitarios (ROI), and the first character tells a buyer abroad what kind of holder it faces. Below is how to check each number from outside Spain: the official route, and what it does not show.

01 · Spain Tax Identification Number Types at a Glance

Spain has one tax identification number for everyone, the NIF, in four shapes that depend on the holder.

PointNIF from the DNINIE; K, L, M NIFsEntity NIF (formerly CIF)
Local name (individuals)número del DNI con letraNIE; NIF K, L o MNot applicable
Issuing authorityMinisterio del InteriorInterior (NIE); AEAT (K, L, M)AEAT
Format and length8 digits + letterX, Y or Z, or K, L or M, + 7 characters + letterletter + 7 digits + control character
Check ruleNumber mod 23, published tableNIE: same rule after X, Y, Z become 0, 1, 2; K, L, M: same rule on the seven digitsNot published
Legal basisRGAT art. 19.1; RD 255/2025RGAT arts. 19.2, 20, 21; Orden INT/2058/2008RGAT art. 22; Orden EHA/451/2008
VAT/GST relationES + NIF if in the ROIES + NIF if in the ROIES + NIF if in the ROI
Registry number relationNoneNoneRegistro Mercantil entry is separate
Where it is printedDNI cardNIE document; AEAT tax ID cardAEAT tax ID card; invoices
Official lookup for individualsAEAT third-party check (Cl@ve or certificate)AEAT third-party checkNot applicable
Official lookup for businessesVIES for the ES formVIES for the ES formAEAT checks; VIES; revoked-NIF files
Last verified28 October 202628 October 202628 October 2026

Given a Spanish number by a supplier or customer, our tax identity engine first tests its structure against the published format, then puts it to an official source where one answers, and keeps that answer with the time it was given.

02 · What to Ask a Spanish Counterparty For, and What the First Letter Tells You

Ask for the NIF exactly as printed, letter included, and for the ES form when the deal is an intra-EU supply; the first character then identifies the holder.

Article 27.3 of the RGAT (Real Decreto 1065/2007) lets anyone dealing with a person or entity in operations with tax effect require its NIF, which the counterparty must give and, where appropriate, prove with the AEAT’s NIF document, the DNI or the document assigning the NIE (article 18.2).

First characterHolderAssigned by
A digitSpanish national with a DNIMinisterio del Interior
X, Y or ZForeign national with an NIEMinisterio del Interior
K / LSpaniard under 14 in Spain / Spaniard abroad, without a DNIAEAT, on request
MForeign national without an NIEAEAT
A to V (published keys)Spanish entity, by legal formAEAT
N / WForeign entity / permanent establishment of a non-residentAEAT

A common error is an NIF filed without its letter, the one testable character; suppliers may also still say CIF, a label retired in 2008.

Searchers abroad use their languages: TIN-Nummer Spanien in German, TIN nummer Spanje in Dutch, TIN Spania in Romanian, NIF Espanha consulta in Portuguese, and “foreign tax identification number España” or “foreign tax identifying number” on English forms. The value each field expects is the NIF, which the European Commission’s pages call the taxpayer identification number.

03 · Spain TIN Format and Structure: Check a Number by Its Letter

Every Spanish NIF has nine characters, and for a DNI or an NIE the last is a letter computed from the digits by a rule the Ministerio del Interior publishes: divide the number by 23 and read the remainder in this table.

Remainder01234567891011
LetterTRWAGMYFPDXB
Remainder1213141516171819202122
LetterNJZSQVHLCKE

The ministry’s worked specimen is 12345678: divided by 23 it leaves 14, which is Z, so the NIF reads 12345678Z. I, O, U and Ñ never appear in the table, so a DNI ending in O fails on sight. For an NIE, X becomes 0, Y 1 and Z 2 before the same division; a fictitious Y1234567T becomes 11234567, leaves 10 and points to a letter other than T, so it fails.

No official algorithm for a company NIF’s control character appears in the sources read: Orden EHA/451/2008 says only “un carácter de control”, and the Commission’s VIES page states it cannot divulge Member States’ algorithms. For K, L and M numbers, a 2008 AEAT technical note applies the same division by 23 to the seven digits after the letter. For company NIFs, the check stops at structure: a fictitious I1234567A fails at once, because no entity key uses I. In VIES the Spain format is ES and nine characters whose first and last may not both be digits, as in ES12345678Z, built from the specimen.

04 · Issuing Authority and Registration Process: Spaniards and Foreign Residents

For individuals the NIF is the DNI number for Spanish nationals and the NIE for foreign nationals; the AEAT assigns its own number only to those who have neither, as its guidance for individuals explains.

Article 19.1 of the RGAT makes the DNI number and its letter a Spaniard’s NIF, and Real Decreto 255/2025 puts both on the front of the card. Spaniards abroad and those under 14 are not obliged to hold a DNI and may ask the AEAT for an NIF beginning L or K. Foreigners use the NIE assigned under Ley Orgánica 4/2000; one without an NIE who enters operations with tax effect asks the AEAT for an NIF beginning M. Under article 21.1 a K, L or M number stays valid only until its holder obtains a DNI or NIE, which must then be reported within two months.

Your own number is on the document that created it: the DNI card, the NIE document, or the AEAT’s tax identification card, whose electronic code anyone can use on the AEAT site to confirm the card is authentic, according to the OECD and EU sheets. For another person’s number, the Commission’s TIN on the Web checks syntax for natural persons only; it does not confirm that the TIN exists or who holds it.

05 · TIN Verification and Lookup for Businesses: Checking a Spanish Supplier from Abroad

A foreign business confirms a Spanish counterparty through VIES for the ES number, the AEAT’s third-party census check for the NIF, and the AEAT’s files of revoked numbers.

Fictitious example. Isarflur Bad GmbH, a Munich bathroom distributor, is onboarding Azulejos Rambla Seca, S.L., a ceramic tile maker in Castellón, and commissioning a pattern from a British tile designer resident in Valencia. The maker’s form gives an NIF of B, seven digits and a control character, plus its ES form; the designer gives an NIE.

Step 1: Read the letter

B is the key for a sociedad de responsabilidad limitada under article 3 of Orden EHA/451/2008, matching the S.L. The designer’s X, Y or Z marks a foreign national, and the NIE’s letter can be tested as in section 03.

Step 2: Confirm the ES number in VIES

VIES asks the Spanish database and returns valid or invalid for the current day; it cannot confirm a past date or find a number from a name. Spain records in VIES only operators entered in the ROI, which the AEAT calls inscription in the VIES census, so a real business that does not trade within the EU can show as invalid. The Commission also notes that Spanish numbers can come back valid without a name or address.

Step 3: Run the AEAT census check

The AEAT’s third-party NIF check needs Cl@ve Móvil, an electronic certificate or an electronic DNI, and takes one NIF, a typed list or a CSV file of up to 20,000 records. For an entity it answers identified, with the current NIF and company name, not identified, identified but deregistered (baja), or identified but revoked.

Step 4: Look for a revoked NIF

Article 147 of the RGAT lets the AEAT revoke an NIF, for instance after four consecutive years of unfiled annual accounts, and requires publication in the BOE. Under the sixth additional provision of the Ley General Tributaria, publication ends the number’s validity for tax identification and freezes bank charges and credits. The AEAT’s files of revoked and reinstated NIFs can be downloaded without a Spanish credential.

Step 5: Ask whether the NIF is provisional

A new company’s NIF stays provisional until it supplies its deed, statutes and, where needed, registry certificate (RGAT article 24.2), which it must do within a month of registration; if six months pass without them, the AEAT may demand them within ten days and can revoke the number. The entity behind the NIF, its form and directors, come from the Registro Mercantil, which the business registry route answers.

06 · TIN and VAT Number Connection: NIF Intracomunitario, ROI and EORI

The Spanish VAT number, the NIF-IVA or NIF intracomunitario, is the ordinary NIF with the prefix ES, assigned on entry in the ROI under article 25 of the RGAT; an AEAT silence of three months counts as refusal. The AEAT’s ROI page places the obligation on businesses established in the peninsula and the Balearic Islands, and the VAT Act leaves the Canary Islands, Ceuta and Melilla outside the harmonised territory. For rates and registration, see the Spain VAT guide.

For a seller the stakes are concrete: the AEAT says the exemption for an intra-EU supply of goods applies only if the customer has given a valid VAT number from another Member State and the supply is reported on form 349.

Customs uses the same number again: the Spanish EORI is ES followed by the NIF held on entry in the EORI system, unchanged if the NIF later changes, and it does not by itself allow intra-EU trade without the ROI. A non-EU operator with no Spanish tax obligations receives ES, K and eleven characters instead.

07 · Format in Depth: From CIF to NIF, and Older Formats Still in Use

Real Decreto 1065/2007 replaced the CIF with the NIF from 1 January 2008, and Orden EHA/451/2008 set the current composition from 1 July 2008.

The 1975 code ran: legal-form letter, two province digits, five sequential digits and a control digit. The 2008 order substituted a random seven-digit number and redrew the keys: G split into G, U, J and V; Q widened to all public bodies; R created for religious institutions; N confined to foreign entities; W added for permanent establishments. Orden HAP/5/2016 later redefined J and E. The OECD’s sheet, modified in June 2024, omits R from its entity list, so a check built on it alone would reject a religious congregation’s NIF.

Before Orden INT/2058/2008, in force from 16 July 2008, an NIE was X, eight digits and a letter, 10 characters; earlier NIEs stay valid indefinitely. A company NIF changes only with the legal form or nationality (RGAT article 22.1).

08 · Where the NIF Is Required, and Why Accurate Validation Matters

Under article 6.1(d) of the invoicing regulation an invoice must show the issuer’s NIF and, for an exempt intra-EU supply, a reverse-charged operation or a domestic sale by an established issuer, the customer’s NIF as well. RGAT articles 26 and 27 extend the duty to returns, income payments, securities, notarial deeds and insurance.

On a foreign bank’s form, the FTIN field for a Spanish resident takes the NIF, and the AEAT reminds Spanish filers of form 289 to report non-residents’ TIN of residence. The self-certification guide covers how CRS 2.0 and DAC8 handle the TIN field.

09 · Verifying Spanish Tax IDs at Scale

A team onboarding hundreds of Spanish suppliers needs the same checks every time, with a record an auditor accepts.

1. Test the shape first. Syntax validation in 210+ countries tests a number’s structure and, where a check rule is published, its check character, so a mistyped NIF stops before it reaches an official source.

2. Ask the source. Real-time TIN lookup against official sources in 130+ countries confirms that a number exists, is active and belongs to the declared holder, and names the source that answered.

3. Know the company behind it. Official business registries in 120+ countries, searchable by company name, identify the legal entity, and Verify+ runs 30+ tax-native checks across eight areas on that entity before it is paid or invoiced.

4. Run it as a process. API and batch uploads of up to 50,000 tax ID validations each, depending on subscription, clear onboarding backlogs, and re-validation before payment runs and filings catches numbers that lapse after approval.

5. Keep the evidence. Each check leaves an audit-ready record of the question, the source and the time.

Individuals checking their own number should use the AEAT’s services in section 04. The duty to identify a Spanish counterparty stays with the business; TaxDo supplies the checks and their record, and the Tax Identity overview shows how the parts fit.

10 · Recent Changes

2 April 2025: Real Decreto 255/2025 replaced Real Decreto 1553/2005 as the DNI regulation, keeping the number and verification character on the card.

1 February 2024: Real Decreto 117/2024 added a ground of revocation to RGAT article 147 and rewrote the rules for reinstating an NIF.

22 September 2026: the Commission published a study on TINs and possible verification instruments on its TIN page; it changes no law.

11 · Related Reading

Product: TIN lookup and business registry search.

Spain: the Spain VAT guide and Spain’s 2025 tax changes. Neighbours: Portugal TIN check and Andorra tax ID guide; every country is in the global TIN guide.

Common Questions

The TIN number in Spain is the NIF, the número de identificación fiscal, which every person and entity with Spanish tax affairs must hold under the General Tax Act. A Spanish national’s NIF is the DNI number: eight digits and a check letter; a foreign national’s is the NIE, X, Y or Z with seven digits and a letter; those with neither get an AEAT number beginning K, L or M. Companies receive a nine-character NIF: a legal-form letter, seven digits and a control character. With ES in front it is the VAT number.

References

This guide summarises the rules on the Spanish NIF, NIE and NIF-IVA in Ley 58/2003 General Tributaria, Real Decreto 1065/2007 and Orden EHA/451/2008, as published in the BOE and applied by the Agencia Estatal de Administración Tributaria, read on 28 October 2026. It is general information, not tax or legal advice; confirm any position with the AEAT or a Spanish tax adviser before relying on it.
TaxDo
TaxDo Team Tax & Regulatory Advisory Team LinkedIn Facebook X

Unmatched Real-Time Tax ID Validation in 130+ Countries

TaxDo gives you instant access to real-time Tax ID validation/lookup in 130+ countries, powered by direct connections to official tax authorities. Skip the format checks. Get the truth.