Documents

NIF and NIE: what the difference is and what a NIF is

NIF and NIE differ in purpose: the NIF (número de identificación fiscal) is a tax identification number, while the NIE is a foreigner's identity number. For a foreigner they are the same, so if you have a NIE you do not need a separate NIF.

Information material, not an individual legal opinion. Conditions apply to each specific situation and may change.
In brief
  • For a foreign national, the NIF and the NIE are the same: the NIE is your tax number (art. 20 of the tax regulation RD 1065/2007). If you already have an NIE, you do not need a separate NIF [1].
  • An NIF is needed for any dealings with tax significance: tax returns, tax registration, transactions. The obligation to have one is set out in article 18 of the same regulation [1].
  • If you need to carry out a tax transaction but have no NIE, the AEAT assigns a temporary nine-character NIF starting with the letter M. It is valid until you obtain an NIE, and the new number must be reported within two months [1].
  • An NIE is assigned automatically in an immigration procedure or on application (form EX15, fee under modelo 790 código 012, decision within 5 days, silence means refusal) [2][3].
  • The NIE is a number, the TIE is a card, and a permit is a separate decision by the authority. Getting an NIE does not give you the right to live or work in Spain [2][4].

What is the NIF?

The NIF (número de identificación fiscal) is the number under which the Spanish tax administration identifies a person or a company. It is needed in all dealings with tax significance: filing tax returns, tax registration, transactions. The obligation to have an NIF and the ways to prove it are set out in article 18 of the tax regulation (Real Decreto 1065/2007): it is proved by a document from the tax authority, by a DNI, or by the document in which the NIE was assigned [1].

How does the NIF differ from the NIE and the TIE?

These are three different things: a number for tax, a foreign national’s identity number, and a card. For a foreign national, the first two have the same digits.

WhatWhat it isWhat it is for
NIFtax number; for a foreign national it is the same as the NIE [1]taxes and tax transactions
NIEnúmero de identidad de extranjero: a foreign national’s personal, unique number, assigned by the Dirección General de la Policía [2]identification in all procedures and documents
TIEtarjeta de identidad de extranjero: the card that documents the permit granted; you apply in person within one month if the permit is valid for more than six months [2]proof of your status in Spain

The NIE number appears on all documents issued to a foreign national, but neither the NIE nor the NIF proves the right to live and work in Spain [2]. More on the card and the permit: NIE, TIE and residence permit: what is the difference. How to get the number in Barcelona is described in the article NIE in Barcelona step by step.

What NIF does a foreigner have?

For a foreign national, the NIF is the NIE number assigned or granted to them under the immigration law [1]. If you do not have an NIE yet but need to carry out a tax transaction, you ask the tax authority to assign a number. It has nine characters: the letter M, seven alphanumeric characters and a check letter [1].

This number is valid until you obtain an NIE. After that, within two months you must report the new number to the tax authority and to anyone you gave the old one to. If both numbers have been issued, the NIE takes priority [1]. There is no need to get a separate NIF “just in case”: if you have an NIE, you do not need one.

How do you get an NIE?

There are two ways: automatically or on application. The Dirección General de la Policía assigns an NIE automatically to people for whom a procedure to obtain a residence or stay document has been opened, and to people with a case file under the immigration law. For visas, this applies only to those that allow you to stay in Spain for more than 90 days [2].

An NIE on application is requested by people who have economic, professional or social interests in Spain. Conditions: you are not in Spain irregularly and you explain your reasons. The application (form EX15) is submitted by the applicant in person to the police, through an oficina de extranjería or a police station, or from abroad through a consulate. The receipt for modelo 790 código 012 is attached to the application [2][3].

The decision deadline is five days from receipt in the registry; if there is no answer, the application is deemed rejected; you can appeal with a reposición within one month or in court within two months [3]. We do not give the fee amount here because it is updated; check the form on the police website (more: what modelo 790 is; the figures are covered in the article how much an NIE costs).

What NIF does a company have?

Companies have their own NIF: the tax authority assigns it to the company, and it does not change when the articles of association are amended, unless the legal form or nationality changes. The number encodes the legal form, a random number and a check character [1]. A company’s number and its owner’s NIE are different numbers and cannot be used in place of each other.

If you are moving and choosing a ground for a residence permit, your NIE number will be issued during the procedure: the steps for the different grounds are set out on the page Residence permit in Barcelona, and document preparation is described in the document service.

Frequently asked questions

What is the difference between an NIF and an NIE?
The NIF is a tax number; the NIE is a foreign national’s number for immigration and other procedures. For a foreign national they are the same: the NIF equals the NIE (art. 20 RD 1065/2007). The difference is in purpose, not in the digits: the NIE also appears on the permit and on the TIE, while the tax authority needs the NIF for tax returns and transactions. [1][2]
Do I need a separate NIF if I already have an NIE?
No. A foreign national’s tax number is the NIE. A temporary number with the letter M is issued only to people who have no NIE but need to carry out a tax transaction. Once the NIE is issued, you report it within two months to the tax authority and to everyone you gave the old number to. [1]
What is an NIF starting with the letter M?
A temporary tax number for a foreign national without an NIE: nine characters, the first being the letter M. It is valid until the person obtains an NIE; after that, the new number is reported to the tax authority within two months (art. 20 and 21 RD 1065/2007). If both numbers have been issued, the NIE takes priority. [1]
Can you get an NIE without a residence permit?
Yes, if you have economic, professional or social interests in Spain, are not in the country irregularly and state your reasons (art. 205 of regulation 1155/2024). The NIE does not give you the right to live or work in Spain: it is a number, not a permit. [2][3]
How many days does it take to process an NIE application?
A maximum of five days from receipt of the application in the registry. If there is no answer, the application is deemed rejected: silence means refusal, not approval. Appeals: a reposición within one month or court proceedings within two. How long an application actually takes depends on the police, and the authority’s page makes no promises about this. [3]

Official sources

  1. BOE · Real Decreto 1065/2007, articles 18 - 22 (número de identificación fiscal) ↗
  2. BOE · Real Decreto 1155/2024, articles 205 and 209 (NIE and tarjeta de identidad de extranjero) ↗
  3. Policía Nacional, sede electrónica · Asignación de NIE a instancia de interesado (formulario EX15) ↗
  4. Policía Nacional, sede electrónica · Tarjeta inicial o renovación de residencia (formulario EX17) ↗

Sources reviewed on 02.10.2026. Consolidated texts and government reference pages are for information only: applying the law depends on official publications, amendments and the specific circumstances. Reviewed by lawyer Francisco Romero Jiménez (ICAB 33641) on 21.10.2026.

Turn the information into questions.

The navigator helps you gather topics for an individual review. It does not determine your right to a residence permit and does not submit an application.

Build your checklist

How ReloVictory works: a 15-minute consultation is free, a full consultation costs €121 for 45 minutes; support is priced by quote, and fees (tasas) and translations are paid separately. The team’s lawyer handles the legal side, and a graduada social handles tax and administrative matters. More: about the team.

Prefer to do it yourself? Step-by-step guides: residence permit in Barcelona: from empadronamiento to TIE and route cards by residence ground.

How does this apply to you?

Choose your first step with a short quiz or discuss your questions with the ReloVictory team.