NIF in Spain: How to Apply for Your Spanish Tax ID Number, and NIF vs CIF

In short
The NIF question in Spain is really a translation problem. Foreigners arrive expecting Portugal's logic and queue for the wrong document.
Summarise this article with the AI of your choice:
The NIF in Spain is the tax identification number used for tax purposes and official dealings with the Spanish tax administration. For Spanish citizens, the NIF usually matches the DNI. For most foreign individuals, it usually matches the NIE. If a foreigner needs a tax ID before having a NIE, Spain may assign a temporary NIF M. Companies and other legal entities also need a NIF to operate and comply with tax rules in Spain.
If you are moving to Spain, buying property, starting a business, signing certain contracts, or handling other tax-related formalities, understanding the NIF number in Spain is one of the first practical steps. And it is also one of the most misunderstood.
This guide is for foreigners buying property, working, investing, or running a business tied to Spain, including people who are not living there yet. It covers what the NIF is, how it differs from the NIE, who needs one, how to apply, the documents involved, how to check a number, and what tax obligations come attached.
Spanish NIE
Your Spanish NIE, from abroad
- Apply online in 5 minutes
- We attend the appointment
- Notary fees included
Fromโฌ199
Get my NIE4.8/51,500+ reviews
Delivery from 48 hours
The simplest way to get your company's Spanish NIF
The NIF (Nรบmero de Identificaciรณn Fiscal) is the tax ID the Spanish authorities assign to your business. Any foreign company selling on a Spanish marketplace, registering for EPR compliance, or running a one-off operation in Spain needs one. It's what lets the Agencia Tributaria recognize your company on Spanish soil, even without a local office or subsidiary.
Start my application now

Receive your company's Spanish NIF in 48 hours
No paperwork, notary, or translations needed
We file directly with the Agencia Tributaria
What is the NIF in Spain?
The NIF, Nรบmero de Identificaciรณn Fiscal, is Spain's tax identification number. It is the code the tax system uses to identify anyone (a person or a company) doing something with tax relevance in Spain. It is administered by the Agencia Tributaria (AEAT), Spain's tax authority.
Think of the NIF number in Spain as your fiscal fingerprint. File taxes, open a bank account, sign a contract, buy a property, draw a salary, issue an invoice: the tax identification number sits underneath all of it. Spain's tax regulation is direct on the point. Individuals and legal entities must hold a NIF for dealings with tax relevance.
Here is the part that confuses almost every newcomer. The Spanish tax identification number is rarely a brand-new number you receive. It is usually a role attached to a document you already have:
- Spanish citizens: the NIF is the DNI number plus its control letter.
- Foreign individuals: the NIF is normally the NIE.
- Companies and entities: the NIF is a separate code, starting with a letter that signals the legal form.
So when a foreigner in Spain says "I need a NIF," nine times out of ten they need a NIE, because the NIE is what does the fiscal job.
The difference that actually matters
NIF, NIE, DNI, and CIF are not four competing numbers. They are different labels, and for most foreign individuals the NIE simply is the NIF. The confusion is the single biggest source of wasted appointments.
Here is the difference in one table:
| Term | What it is | Who uses it | Link to the NIF |
|---|---|---|---|
| DNI | National identity document for Spanish citizens | Spanish nationals | A Spanish citizen's DNI is their NIF |
| NIE | Foreigner identity number, issued by the Ministry of the Interior | Foreigners with an interest in Spain | A foreign individual's NIE works as their NIF |
| NIF | Tax identification number | Everyone with tax-relevant activity in Spain | The umbrella concept for both people and entities |
| CIF | Old company tax ID label | Still said out loud, but formally retired | Merged into the NIF for companies in 2008 |
The CIF point trips up businesses. Spain folded the old Cรณdigo de Identificaciรณn Fiscal into the NIF system back in 2008. The number and its function did not change, only the name. Walk into any office in Spain and people will still ask a company for its "CIF." They mean its corporate NIF. You can hand it over without correcting anyone.
So the practical rule on NIE vs NIF: if you are a foreign person signing as yourself, your NIE is your NIF. If you are signing for a registered company, you use the company's NIF (the artist formerly known as CIF).
Who needs a NIF in Spain?
Any natural person or legal entity carrying out an operation with tax relevance in Spain needs a NIF, and you do not have to live in Spain to be on the hook. That last clause is where foreigners get caught.
AEAT's own examples of tax-relevant operations include an employment contract, property purchase documents, and university admission. In real life, here is who needs one.
Foreign individuals
If money is moving and it touches Spanish soil, you need the number. Foreign individuals need a NIF (in practice, a NIE) to:
- Buy, sell, or inherit property. A notary will not sign the deed (escritura) without it. Our guide to investing in Spain covers the purchase costs by region. Inherit a flat or a Spanish bank account, and you need a NIF to settle inheritance tax before the asset goes into your name.
- Open a bank account or take a mortgage. Some banks open a non-resident account on a passport alone, then ask for the NIF within a few months to keep it live.
- Work or go freelance. No company can register you with Social Security without it. As an autรณnomo, you need it to invoice and handle VAT.
- Run daily life: utilities, a car registration, private health insurance for a visa.
Non-resident investors
You can be a non-resident and still need a Spanish tax number. Buy a holiday home you rent out, hold Spanish shares, or receive Spanish-source income, and the NIF is what ties you to the filing.
Foreign companies and business in Spain
A legal entity needs its own NIF to operate. Foreign companies selling into Spain or setting up locally apply for a corporate NIF, and the trigger is often quieter than people expect. An e-commerce seller who has never set foot in Spain but stores stock in a Spanish warehouse (think Amazon FBA) can be required to register a foreign-entity NIF to handle Spanish VAT. If your business in Spain issues invoices, signs contracts, or files returns, the NIF is the entry ticket.
The simplest way to get your company's Spanish NIF
The NIF (Nรบmero de Identificaciรณn Fiscal) is the tax ID the Spanish authorities assign to your business. Any foreign company selling on a Spanish marketplace, registering for EPR compliance, or running a one-off operation in Spain needs one. It's what lets the Agencia Tributaria recognize your company on Spanish soil, even without a local office or subsidiary.
Start my application now

Receive your company's Spanish NIF in 48 hours
No paperwork, notary, or translations needed
We file directly with the Agencia Tributaria
How to apply for a NIF
There are three routes to apply for a NIF, and the right one depends on whether you are a foreign individual, a foreigner without a NIE who needs a number fast, or a company. Pick the wrong route and you queue for the wrong office.
Route 1: foreign individual (get the NIE)
Because your NIF is your NIE, the standard NIF application for a person is really a NIE application.
- Where: at an Immigration Office or a National Police station inside Spain, or at a Spanish consulate if you are still abroad.
- The form: EX-15, the Solicitud de Nรบmero de Identidad de Extranjero.
- The fee: the Modelo 790, cรณdigo 012 tax, paid at a collaborating bank.
- The catch: you must state the economic, professional, or social reason for the request, and you cannot be in Spain irregularly.
The Ministry of the Interior sets a target of five days to resolve the request from the moment it enters the competent office's register. If no answer comes after that period, the request is understood as rejected, and you start again.
Route 2: foreigner without a NIE (Form 030, the NIF M)
If you need a tax ID urgently and do not yet have a NIE, you can ask AEAT directly using Form 030 for a temporary NIF M. More on what that is, and its catch, below.
Route 3: companies (Form 036)
A company applies for its corporate NIF through Form 036 (Modelo 036), the census declaration. The request is generally made within one month of the entity's constitution or establishment in Spain. Foreign companies submit incorporation deeds and a certificate of good standing, apostilled or legalised, with a sworn Spanish translation. The signing representative needs their own valid Spanish NIE/NIF first, which is why many foreign companies appoint a local representative by power of attorney.
What documents you need
For an individual NIF, you need proof of identity, proof of your NIE situation, and a document proving the tax-relevant reason. A representative needs a power of attorney. AEAT is specific about this for the Form 030 / NIF M route.
| Requirement | What counts |
|---|---|
| Identity | A valid passport or equivalent national identity document proving identity, age, and nationality |
| NIE status | Proof that you have requested a NIE, or proof you are not required to have one |
| Tax-relevant reason | A document proving the operation: employment contract, property purchase papers, or a university admission letter |
| Representation | If someone files for you, a power of attorney authorising them to submit the application |
For the NIE route (Route 1 above), the core set is the completed EX-15, the paid Modelo 790 cรณdigo 012, your valid passport with a full copy, and the documentary proof of your reason for needing the number.
A word from the field. Recent expat reviews and forum threads through 2025 and 2026 describe the friction as the appointment, not the paperwork. People report weeks of hunting for an in-person cita previa, and being sent to the wrong window more than once. The documents are rarely the wall. The booking system often is. (Reported experience, not an official figure.)
What is the NIF M?
The NIF M is a temporary tax number AEAT assigns to a foreigner who does not have a NIE but needs to complete a tax-relevant operation. It is a bridge, not a destination. It is valid only until you get a DNI or NIE.
AEAT's Form 030 guidance lists three special starting letters for individuals: K for Spanish minors under 14 resident in Spain, L for non-resident Spaniards not required to hold a DNI, and M for foreigners without a NIE.
Two practical points decide whether the NIF M is right for you.
It often needs a presenter. AEAT's online Form 030 route requires the person submitting it to already hold a NIF in the taxpayer census and to identify with an electronic certificate, DNIe, or Cl@ve. Translation: many applicants cannot file it alone and need a representative who can.
It expires into your NIE. Once you obtain a NIE, you must tell AEAT and anyone who holds your fiscal number, within two months. If you end up with both an AEAT-assigned NIF and a DNI or NIE, the DNI or NIE prevails. For most foreigners settling in Spain, the NIE is the number to aim for. The NIF M just keeps a deal alive while you wait.
Company NIF prefixes
A Spanish company NIF is nine characters: one letter for the legal form, seven digits, and one control character. The letter tells you what kind of entity you are dealing with. The codes come from Orden EHA/451/2008, the regulation that defines them.
| Letter | Entity type |
|---|---|
| A | Sociedad Anรณnima (public limited company) |
| B | Sociedad de Responsabilidad Limitada (limited liability company, the common SME form) |
| C | Sociedad Colectiva (general partnership) |
| D | Sociedad Comanditaria (limited partnership) |
| E | Comunidades de bienes and other entities without legal personality |
| F | Sociedad Cooperativa |
| G | Asociaciones (associations) |
| H | Comunidades de propietarios (homeowners' communities) |
| J | Sociedades Civiles (civil partnerships) |
| N | Foreign legal entities |
| P | Corporaciones Locales (local public bodies) |
| Q | Organismos pรบblicos (public bodies) |
| R | Religious congregations and institutions |
| S | State and regional administration bodies |
| U | Uniones Temporales de Empresas (joint ventures) |
| V | Other types not covered above |
| W | Permanent establishments of non-resident entities |

For foreigners, the two that matter are N and W. An N number is for a foreign entity without a permanent establishment in Spain (the Amazon FBA seller is a typical case). A W number is for a foreign company operating through a permanent establishment, like a branch or office, on Spanish soil.
The letter never changes the tax function of the number. It is a label, so A12345678 reads as a Sociedad Anรณnima and B12345678 as a Sociedad Limitada at a glance. Useful when you are checking that a supplier or partner is registered under the legal form they claim.
How to verify a NIF number
To verify a NIF number, use the Agencia Tributaria's official validation service for third parties. Independent calculators can check the control character, but only AEAT confirms the fiscal status behind a number. This matters when you are invoicing a Spanish client or onboarding a partner and need to know the number is real and active.
There are two layers to a check, and people confuse them:
- Format and control character. The final letter or digit is generated by an algorithm, so a free verifier can flag a number that is mathematically impossible. That catches typos, not fraud.
- Fiscal status. Whether a number is genuinely registered and in good standing with the tax authorities is a question only AEAT's own validation service answers. This is the check that protects you on a real transaction.
For intra-EU dealings, there is a third layer. A Spanish operator's intra-community VAT number (the NIF-IVA, your NIF prefixed with ES) can be checked in VIES, the EU-wide system, to confirm a counterpart is registered for cross-border VAT. If a number is not in VIES, the tax administration has not cleared it for those operations.
What the NIF does and does not mean for tax
Holding a NIF or NIE creates tax obligations only when you actually have tax-relevant activity in Spain. The number identifies you. It does not, by itself, make you a tax resident. Getting this wrong costs people real money in over- or under-filing.
Your tax obligations with a NIF depend on what you do, not on owning the number. Three points keep most foreigners out of trouble.
The NIF is not a residency switch. Spanish tax residency for individuals turns on facts: staying in Spain more than 183 days in the calendar year, or having your main base or centre of economic interests in the country. Plenty of foreigners hold a NIE for a property purchase or an inheritance while remaining non-resident for tax purposes. The tax identification number NIF exists so Spain can identify you in dealings with tax relevance in Spain, and nothing more.
Non-resident owners still file. Own a property in Spain as a non-resident and you have an annual non-resident income tax filing (the IRNR, Modelo 210), whether the place is rented or sitting empty. The NIF is what that return runs on.
A normal NIF is not a VAT number. If your business does certain intra-EU operations, you register separately in the ROI (the Register of Intra-Community Operators) through Modelo 036 to obtain the NIF-IVA. Having a NIF does not grant it automatically.
Common mistakes
Most NIF problems trace back to five wrong assumptions. Clear them and the process gets short.
"Spain has a NIF like Portugal." Different doors. In Portugal a foreigner often requests a NIF directly. In Spain a foreigner usually needs a NIE, and that NIE becomes the NIF.
"NIE and NIF are two separate numbers for me." Usually they are the same number wearing two hats. For a foreign individual, the NIE is the NIF.
"The NIF M is permanent." It is temporary, valid until you get a DNI or NIE, and you have two months to report the new number once you do.
"A NIE means I can live in Spain." It does not. The NIE identifies you. Living rights come from EU registration, a visa, a residence authorisation, or a TIE, depending on your case. A number is not a permit.
"My NIF-IVA is automatic." It is not. Intra-EU VAT operations need ROI registration through Modelo 036, and then you appear in VIES.
The simplest way to get your company's Spanish NIF
The NIF (Nรบmero de Identificaciรณn Fiscal) is the tax ID the Spanish authorities assign to your business. Any foreign company selling on a Spanish marketplace, registering for EPR compliance, or running a one-off operation in Spain needs one. It's what lets the Agencia Tributaria recognize your company on Spanish soil, even without a local office or subsidiary.
Start my application now

Receive your company's Spanish NIF in 48 hours
No paperwork, notary, or translations needed
We file directly with the Agencia Tributaria
Final takeaways
The NIF question in Spain is really a translation problem. Foreigners arrive expecting Portugal's logic and queue for the wrong document.
Get the mapping right (foreign person equals NIE equals NIF, company equals its own NIF, no NIE yet equals a temporary NIF M) and the rest is paperwork. Hold the number, but remember what it is: an identifier, not a residence permit and not a tax-residency verdict.
Those are separate questions, with separate rules, and the difference is what keeps your move clean.















