NIE, NIF and CIF: three names, and only two exist
If you are a foreign national, your NIF is your NIE: that is article 20.1 of Real Decreto 1065/2007. The CIF stopped existing as a thing in its own right. And anyone without a NIE applies for a NIF beginning with M.
First things first: Cairos is in Spanish
You can read this page in several languages, but the application you are going to work in is in Spanish only: the menus, the invoices, the tax forms and the help screens. There is no English version and there is still no date for one. Support answers in Spanish too. If you have just arrived in Spain and do not read Spanish comfortably, tell us before you decide: we would rather you knew now than found out on your first day. Our plans and their limits are on pricing.
If you settle in the Basque Country or Navarre, this changes
Álava, Bizkaia, Gipuzkoa and Navarre have their own foral tax regime: you do not file with the state Tax Agency but with their Hacienda Foral, which has its own forms, its own deadlines and its own rates. This page describes the common regime, which is the one that applies in the rest of Spain. And there is one difference worth knowing before any other: in Álava, Bizkaia and Gipuzkoa the invoicing obligation is not VeriFactu, it is TicketBAI, and it is already in force. In Navarre there is no equivalent system approved today. If you are going to settle there, start with that page and talk to an accountant based in that territory.
Three names, two things, and one that no longer exists
This confusion costs a lot of people weeks, so let us be concrete.
| Name | What it really is | Who issues it | The regulation |
|---|---|---|---|
| NIE Foreigner's identity number | A personal, unique, exclusive and sequential number by which the Spanish administration identifies you. It appears on every document issued to you. | Directorate-General of the Police and the Guardia Civil | Art. 206 of RD 557/2011 |
| NIF Tax identification number | The number by which you exist as far as Hacienda is concerned. If you are a foreign national, your NIF is your NIE. The NIF is not a separate number you have to apply for as well. | The Tax Agency, although in your case it reuses the NIE | Arts. 18 and 20 of RD 1065/2007 |
| CIF Tax identification code | It no longer exists as a thing in its own right. It was the number for legal persons before everything was unified into the NIF. People still say it out of habit. | — | Sixth additional provision of Ley 58/2003 |
In short: you apply for a NIE and with that you already have a NIF. If someone tells you that you also have to “go and get your NIF”, either they mean something else or they are wrong.
Who has to have a NIE and who does not
Article 206.1 of Real Decreto 557/2011 identifies three groups:
- Foreign nationals for whom a procedure is started to obtain a document allowing them to remain in Spain, provided it is not a visa.
- Those against whom an administrative immigration file has been opened.
- And — this is the one that matters here — those who deal with Spain through their economic, professional or social interests.
The difference between the three groups is not a formal one. For the first two, the NIE is granted of the authorities' own motion. For the third, it is not: they have to apply for it, and on two conditions written into the legislation. The first, not being in Spain irregularly. The second, giving the reasons for the application.
The case of the shareholder who never sets foot in Spain
An investor who buys shares in a Spanish S.L. and lives abroad falls squarely into the third group: they deal with Spain through their economic interests. They need a NIE even if they never come. And they can apply for it from their own country, at the consulate.
How to apply for a NIE, inside and outside Spain
From Spain
The application goes to the Directorate-General of the Police and the Guardia Civil, directly or through the Oficinas de Extranjería, the immigration offices, or the police stations. It requires an appointment, and in practice that is the bottleneck.
From outside Spain
The application goes to the Comisaría General de Extranjería y Fronteras, the national immigration and borders headquarters, through Spain's consular offices abroad. That is the same article 206.3, so you do not have to travel just for this.
The deadline that really is in the legislation
Five days maximum to decide, counted from when the application reaches the register of the body responsible for processing it. That is the deadline for the procedure, not the total time from when you start looking for an appointment.
Through a representative
The formality can be handled through a duly authorised representative. That is what usually happens when the applicant is abroad. The specific conditions of the power of attorney are a matter of immigration law, not tax law.
Why there are no fees or appointment times here
Because they change, and because their source is not a consolidated text on the BOE that we can cite. An out-of-date fee on a website is worse than none at all. The amounts in force and how to get an appointment are on the Policía Nacional website.
The NIF beginning with M: for anyone without a NIE
Some people need to deal with Hacienda and have no NIE. Article 20.2 of Real Decreto 1065/2007 solves that case: individuals without Spanish nationality who do not hold a NIE — either temporarily, because they are required to have one, or permanently, because they are not — must ask the tax administration to assign them a tax identification number when they are going to carry out transactions with tax significance.
That number has nine characters: an initial M, seven alphanumeric characters and a check letter. And there is one detail worth knowing: if you do not apply for it, the Tax Agency can register you of its own motion on the Census of Taxpayers and assign you the corresponding number.
To complete the map, the same regulation defines two other letters that sometimes turn up and confuse people:
| Initial letter | Who it is assigned to | Article |
|---|---|---|
| M | A foreign national without a NIE who deals with Hacienda | Art. 20.2 of RD 1065/2007 |
| L | A Spaniard resident abroad with no obligation to hold a DNI | Art. 19.2 of RD 1065/2007 |
| K | A Spaniard resident in Spain under fourteen | Art. 19.2 of RD 1065/2007 |
A NIF with an M does not replace a NIE and does not save you applying for one when you are required to have it. It is a way of operating in the meantime, or permanently if you are never going to be required to have a NIE.
Which number goes on the invoice
The invoicing regulations require the tax identification number of whoever issues the invoice and, where applicable, that of the customer. Translated into your situation:
- You, a foreign autónomo in Spain: your NIE, which is your NIF. With no prefix.
- Your Spanish company: the company's NIF, which begins with B if it is an S.L. Not its shareholders' NIE.
- A business client in another EU country: their intra-Community VAT number with their country's prefix, checked in VIES. Without that, the sale is not exempt. We go into it in invoicing clients outside Spain.
- You, when you trade with the EU: your own intra-Community VAT number, which is your NIF with the ES prefix in front, and only once you are registered on the Register of Intra-Community Operators.
In Cairos, the number lives on the contact's record and comes out on every invoice by itself, with its prefix where that applies. A European client's intra-Community VAT number can be checked against VIES from that same record, and the date of the check is saved.
With your NIE you can already issue proper invoices
Sequential numbering, VeriFactu included and your European clients' intra-Community VAT numbers checked in VIES.
Questions about the NIE and the NIF
What is our field and what is not
Tax and invoicing are our field: taxes, forms, VAT and compliant invoices. Visas, residence permits and consular formalities are not. We explain them here because your tax position makes no sense without them, but we are not immigration lawyers and this does not replace one. For an actual case — a refusal, a renewal, an arraigo application — find a specialist firm.
How this page is kept up to date
Every figure on this page comes from the consolidated text on the BOE or from the Tax Agency's E-Office, with the legislation cited beside it. What changes every year — the cuota de autónomos, the fees, the bands — is deliberately not reproduced here: an out-of-date figure on a website is worse than no figure at all. Last reviewed: 27 August 2026. If you spot something out of date, write to us at hola@cairos.es.
This is information, not tax or legal advice. Immigration formalities are handled by an immigration lawyer.
You have your number. Now you need to register
The next step is the census declaration, and it is filed before your first invoice. It is set out step by step.
Information with the legislation cited · The application, in Spanish only