Skip to main content
Practical guide for completing census form 036

Individuals

Natural persons of Spanish nationality

General rule: DNI

As a general rule, the NIF of natural persons of Spanish nationality is the number of their National Identity Document ( DNI ) followed by the corresponding code or verification character, consisting of a capital letter (article 19.1 of RGAT ). It follows the nine-character format: eight digits (taking into account that the first ones may be zeros) plus a control letter.

This number is assigned by the Ministry of the Interior and its basic regulations are set out in Royal Decree 255/2025, of April 1, which regulates the National Identity Document (previously Royal Decree 1553/2005, of December 23, which regulates the issuance of the national identity document and its electronic signature certificates modified by Royal Decree 1586/2009 and Royal Decree 869/2013) and does not imply any change in the procedures to be carried out by citizens for the issuance or renewal of said document.

Royal Decree 255/2025 is issued with two objectives. Firstly, it regulates the National Identity Document in physical and digital versions. The digital version has the same validity period as the physical version. Secondly, it establishes that the documents necessary for the issuance of the National Identity Document will be collected electronically (people who do not have a single civil registry must provide a literal birth certificate on paper), unless the interested party objects, and contemplates the issuance of DNI to Spaniards abroad in certain embassies and consulates.

Regulation of the issuance of the national identity document

Until the entry into force of Royal Decree 255/2025, the regulatory provisions governing the basic aspects of the DNI were contained in Royal Decree 1553/2005, of December 23, which regulated the issuance of the national identity document and its electronic signature certificates.

Royal Decree 255/2025 aims to regulate the process of issuing, managing and developing the National Identity Document in physical, electronic and digital versions. The most relevant features of the DNI have not changed:

  • The DNI is the document that certifies the identity and personal data of its holder that are recorded therein, as well as the holder's Spanish nationality.
  • It is mandatory for Spaniards over fourteen years of age residing in Spain and for those of the same age who, residing abroad, move to Spain for a period of no less than six months.
  • On the front of ID card It will include, among other data, the number and personal and non-transferable verification character of the DNI.
  • The validity period of the DNI will be:
    1. Two years when the applicant has not reached the age of five.
    2. Five years, when the holder has not reached the age of thirty at the time of issue or renewal.
    3. Ten years, when the holder has reached the age of thirty and has not reached the age of seventy.
    4. More than 10 years, when the holder has reached the age of seventy.

Exceptionally, the National Identity Document may be granted a one-year validity in the following cases of issuance and renewal:

  1. When it is physically impossible, on a temporary basis, to take fingerprints of any finger.
  2. In cases where, due to circumstances beyond the applicant's control, one of the required documents cannot be submitted.

Electronic DNI utility

Regulated in Law 6/2020, of November 11, which repeals Law 59/2003, of December 19, on electronic signatures.

The modification of community regulations has led to the repeal of Law 59/2003. These are directly applicable in the member states, therefore, Law 6/2020 only addresses what the regulations leave to the decision of the states.

The DA Article 3 of Law 6/2020 establishes "the national identity document allows the personal identity of its holder to be electronically verified, as well as the electronic signature of documents.All natural or legal persons, public or private, shall recognize the effectiveness of the National Identity Document to prove the identity and other personal data of the holder contained therein, as well as the identity of the signatory and the integrity of the documents signed with their electronic certificates." This same principle is regulated in Article 3 of the Royal Decree 255/2025.

The most relevant notes of said regulation are the following:

  • The activation of the DNI's utility as an electronic signature will be voluntary and will be carried out using a secret personal code, which the DNI holder may enter confidentially into the system.
  • The ID card will have a built-in chip, as a high-security storage medium, where the qualified electronic certificate is integrated.
  • The recognized electronic certificates incorporated into the DNI, which function as a qualified device for creating an electronic signature, guarantee the identity of the holder of the private identification and signature key, allowing the generation of the advanced and qualified electronic signature.
  • They will have a validity period of two years. When the validity of the electronic certificate expires, you may request the issuance of new recognized certificates, keeping the same DNI card as long as it remains valid. To request a new certificate, the physical presence of the holder must be present, in the manner and with the requirements determined by the Ministry of the Interior.
  • As a consequence of the above, the General Directorate of the Police, as the Management Center in charge of the management and issuance of the new DNI, becomes a provider of electronic signature certification services, for which the Ministry of the Interior approved the “Declaration of Certification Practices and Policies”.

Digital utility of the National Identity Document (DNI)

Royal Decree 255/2025 regulates the national identity document in its physical, electronic and digital versions. The digital version of the ID card has the same purpose as the physical format for the identification of people.

The digital ID card, transmitted securely via a mobile application, will have the same validity periods as the physical version.

The digital version works by virtualizing the ID card on the mobile device, through secure communication, without compromising the guarantee of secure identity that current legislation attributes to the ID card. 

Special rules: NIF K and NIF L

In accordance with the above, there are two cases in which it is not mandatory for Spanish citizens to have a DNI: minors under fourteen years of age and over that age residing abroad who move to Spain for a period of less than six months.

However, in both cases, if an operation of a tax nature or with tax implications is carried out, it is necessary, as indicated in article 19.2 of RGAT , to have your own NIF. To do this, it is possible to obtain the DNI voluntarily or, alternatively, request the tax administration to assign a NIF.

This NIF will consist of nine characters with the following composition:

  • An initial letter intended to indicate the nature of this number, which will be:
    • L, for Spanish residents abroad
    • K, for Spaniards who, residing in Spain, are under 14 years of age
  • Seven alphanumeric characters
  • An alphabetical check character

The composition of NIF K and L as defined by the RGAT presents some new features compared to its regulation in the repealed RD 338/1990.

Firstly, until 31 December 2007, the so-called “NIF L” was assigned to Spaniards over the age of fourteen and residing abroad and the “NIF K” to Spaniards under the age of fourteen (article 3.2 of RD 338/1990). That is to say, the letter K was the general one for all Spaniards under fourteen years of age, whether or not they were residents in Spain, and the letter L was for Spaniards over fourteen years of age residing abroad.

However, since January 1, 2008, when the RGAT came into force, the letter L is the general one for all Spanish residents abroad, whether they are over or under fourteen years of age, and the letter K is for Spanish citizens under fourteen years of age residing in Spain.

The amendment introduced by the Regulation will allow a Spaniard under the age of fourteen who resides abroad to be assigned a “NIF L” and to keep it, even after reaching the age of majority, unless he or she moves to reside in Spain. Under the previous regulations, a Spanish minor under the age of fourteen residing abroad had to be assigned a “NIF K” and when he or she turned fourteen he or she would have to obtain a “NIF L” with the resulting inconveniences, both for him or her and for the tax authorities.

Secondly, Royal Decree 338/1990 (article 3.2) configured the NIF including, in addition to the initial letter intended to indicate the nature of the number, two digits to contain an indicator of the province of the tax domicile of its holder or, in the case of non-residents, of the province where it had been requested, five digits that formed a sequential number within each province and an alphabetical verification character.

This configuration had certain drawbacks since the province identifier digits and the associated sequential number were close to being exhausted in some of them. Furthermore, the information provided by the NIF on the province was not relevant since it became obsolete when the taxpayer changed his tax domicile.

For this reason, the new Regulation configures the NIF, in addition to a letter, with seven alphanumeric characters (not just digits) and an alphabetical verification character, which resolves the material problems generated by the old configuration.

In addition to the new features regarding the composition of NIF K and L, the RGAT presents another important new feature: establishes the obligation for all minors who carry out any operation with tax implications to have their own NIF.

Under the previous regulations (articles 3 and 7 of Royal Decree 338/1990), minors were only required to have their own NIF if they were entrepreneurs or professionals. If they were not and did not have an ID card assigned, they could either request the ID card from the Ministry of the Interior, request a “NIF K” from the Tax Administration, or use the NIF of their legal representative.

The option of using the NIF of the legal representative generated some inconveniences in practice since, associated with the same NIF, there could be information corresponding to several people, that of the NIF holder and that of all his representatives, and when all of them were obtaining their own NIF, it was necessary to “separate” that information to associate it with its true holder. With the amendment introduced by the Regulation, the quality of the information associated with each person is improved, assigning it from the beginning to its true “owner”.

In line with the above, section 3 of article 19 of the RGAT states that, in order to identify minors under 14 years of age in their relationships of a tax nature or with tax implications, both the data of the person under 14 years of age, including their NIF, and those of their legal representative must be included.

Individuals of foreign nationality

General rule: NIE

For individuals who do not have Spanish nationality, the NIF is, in general, the foreign identity number ( NIE ) that is assigned to them or provided to them in accordance with Organic Law 4/2000, of January 11, on the rights and freedoms of foreigners in Spain and their social integration, and its implementing regulations (article 20.1 RGAT).

In accordance with Article 205 of the Regulations of Organic Law 4/2000, of January 11, on the rights and freedoms of foreigners in Spain and their social integration, approved by Royal Decree 1155/2024, of November 19 (BOE November 30) the NIE It is assigned to foreigners in the following cases:

  • When they obtain a document that allows them to remain in Spanish territory other than a visa.
  • When an administrative procedure is initiated against them under the regulations on foreigners.
  • When their economic, professional or social interests involve them in relations with Spain.

In the first two cases, the NIE is granted ex officio by the General Directorate of the Police and the Civil Guard. In the third case, the foreigner must request the assignment of the number from said body, provided that two requirements are met: that they are not in Spain in an irregular situation and that they communicate the reasons why they are requesting the assignment of said number.

At this point, it is important to remember that the NIE merely serves to identify the foreigner and that, as the General Immigration and Documentation Office of the General Directorate of Police has pointed out on several occasions, the assignment of the NIE does not prove that the foreigner is in a legal situation in Spain. It also does not prejudge, even if their situation is legal, whether the foreigner is authorized to work and/or reside in Spain.

It is also advisable not to confuse the foreigner's identity number (NIE) with the foreigner's identity card ( TIE ). This card is regulated in article 209 of the Immigration Regulations (RD 1155/2024) and is the document intended to identify the foreigner for the purpose of proving their legal status in Spain and must be requested, except for the exceptions provided for in the regulations, by all foreigners who have been issued a visa or an authorization to remain in Spain for a period of more than six months.

Composition of the NIE

ORDER INT/2058/2008, of July 14 (BOE of the 15th), modifies the Order of the Minister of the Interior of February 7, 1997, which regulates the foreigner card, with regard to the foreigner identity number.

This Order includes the new composition of the NIE, which will consist of nine characters with the following details:

  • An initial letter, which will be X. Once the numerical series is exhausted, the alphabetical order will be followed: Y, Z
  • Seven digits or numeric characters
  • An alphabetical check character

Until the publication of this Order, the NIE consisted of 10 positions: the letter X, 8 digits and a verification code.

To solve the problems caused by the fact that the NIE had 10 characters and the NIF 9, the Ministry of the Interior and the Tax Agency reached an agreement in 1997 whereby only 9 characters would be printed on the NIE accreditation cards: the X, 7 digits and the control code. However, if any NIE card had a 10-character NIE, it had to be registered in the database by omitting the first zero that appeared after the X.

The agreement between the Tax Agency and the Ministry of the Interior was possible at the time because the first digit was 0 and remained valid as long as the number of NIE issued was less than 9,999,999. As the margin for rapid growth in the foreign population in Spain was exhausted, it was necessary to find an alternative formula so that the NIE would have 9 characters, the same as the NIF. Therefore, since July 2008 it has been possible to find foreign identity numbers (NIE) that begin with X, Y or Z.

NIE accreditation

According to the General Immigration and Documentation Office, NIE accreditation can be done by showing the foreigner's identification card, the residence permit or the registration certificate issued to EU citizens, if available. Otherwise, the NIE will be accredited by means of the certificate issued for this purpose by the Ministry of the Interior, which will state the assigned number. The application form on which the number communicated verbally by the Police has been written down by hand is not valid for proving the NIE.

Justification of the need to have a NIE

In order to assign the NIE, some Immigration Offices or Police Stations request documentary justification of the facts that motivate the request for the NIE due to “economic, social or professional interests”, which includes carrying out operations with tax implications.

Obligation to have NIE for EU citizens

Royal Decree 240/2007, of February 16 (BOE February 28), regulates the entry, free movement and residence in Spain of citizens of the Member States of the European Union ( EU) and of other States party to the Agreement on the European Economic Area (EEA)

This Royal Decree was issued to incorporate into the Spanish legal system the content of Directive 2004/38/ CE , of the European Parliament and of the Council, of April 29, 2004, regarding the right of citizens of the Union and their family members to move and reside freely within the territory of the Member States.

Throughout its articles, the Royal Decree regulates the conditions for the exercise of the rights of entry and exit, free movement, stay, residence, permanent residence and work in Spain by citizens of the EU and of the other States party to the EEA Agreement, as well as limitations on the above rights for reasons of public order, public safety or public health. These same rights are recognized, regardless of their nationality, to family members (spouse, partner, descendants and direct ascendants in the care of the citizen or his/her spouse or partner) of citizens of those same States, when they accompany him/her or join him/her in Spanish territory, in the terms indicated in article 2 of the Royal Decree (hereinafter, we will refer to them as "family members").

The Royal Decree regulates stays of less than three months, residence of more than three months and permanent residence.

To stay in Spain for less than three months, possession of a valid passport or identity document is sufficient, both for EU citizens and their family members (Article 6 RD 240/2007).

Citizens of a Member State of the European Union, or of another State party to the Agreement on the European Economic Area, who are going to reside in Spanish territory for a period of more than three months, are required to personally apply to the Foreigners' Office of the province where they intend to stay or establish their residence or, failing that, to the corresponding Police Station, to be registered in the Central Registry of Foreigners. This application must be submitted within three months from the date of entry into Spain, and a registration certificate will be issued immediately stating the name, nationality and address of the registered person, their foreign identity number (NIE) and the date of registration (Article 7 RD 240/2007).

“Family members” who are not nationals of a Member State of the European Union or of another State party to the Agreement on the European Economic Area and Switzerland may reside in Spain for a period of more than three months, but are subject to the obligation to apply for and obtain a “residence card for family members of Union citizens” (Article 8 RD 240/2007).

For permanent residence (articles 10 and 11 RD 240/2007) a general period is established for this purpose (5 years of continuous residence in Spain) and other special periods (for self-employed or employed workers who are in certain situations and their family members).

At the request of the interested party, a certificate of the right to reside permanently will be issued. “Family members” will be issued a permanent residence card.

To what extent does RD 240/2007 affect the obligation of EU citizens to have a NIE?

Royal Decree 240/2007 repeals Royal Decree 178/2003, of 14 February, on the entry and residence in Spain of nationals of Member States of the European Union and other States party to the Agreement on the European Economic Area.

The approval of Royal Decree 178/2003 raised certain doubts about whether the lack of need for a residence card that it contemplated affected or not the obligation to have a NIE for EU citizens.

The aforementioned Royal Decree established that, basically, nationals of the Member States of the European Union, or of Norway, Iceland, Liechtenstein and Switzerland, who were self-employed or employed, students, retirees or pensioners who had paid contributions in Spain and the relatives of these groups, as well as cross-border workers who resided in one of the aforementioned States but worked in Spain, returning every day or at least once a week to their country, could reside in Spain without needing a residence card (article 6 RD 178/2003).

The General Directorate of Foreigners and Immigration, of the Government Delegation for Foreigners and Immigration, of the Ministry of the Interior, clarified that since RD 178/2003 did not regulate the NIE, the Implementing Regulation of Organic Law 4/2000, on the rights and freedoms of foreigners in Spain and their social integration, was applied in this matter, since the aforementioned Regulation was applied in a supplementary capacity, or for the purposes that could be more favorable, to the citizens included in the scope of application of RD 178/2003.

Therefore, the non-requirement of a residence card contemplated in Royal Decree 178/2003 did not affect the obligation to have an NIE in the cases provided for in article 205.1 of the Immigration Regulations:

  1. Foreigners who obtain a document that allows them to remain in Spanish territory other than a visa.
  2. Those who have had an administrative procedure initiated pursuant to the provisions of the regulations on foreigners.
  3. Those who, due to their economic, professional or social interests, are related to Spain.

Royal Decree 240/2007 also does not regulate the cases in which the NIE is mandatory, so EU citizens who are in any of the cases provided for in article 205.1 of the Immigration Regulations (in what is relevant for tax purposes "those who for their economic, professional or social interests are related to Spain"), must request the assignment of the aforementioned number from the Directorate General of the Police and the Civil Guard.

The new feature of RD 240/2007, as regards the identification of foreigners, is that, in general, the provisions of the Immigration Regulations apply to EU citizens in terms of NIE, but in particular, those who reside in Spain for more than three months are required to have a “registration certificate”, which will include, among other data, their NIE.

In short, if the EU citizen does not reside in Spain or remains in Spanish territory for less than three months, he or she will be required to have a NIE if he or she has a relationship with Spain for economic, social or professional interests.  However, if you reside in Spain for more than three months, you will obtain the NIE in any case, since it must appear on the registration certificate that you are required to request.

Special rule: NIF M

In a similar way to what happens in the case of tax identification of Spaniards, for whom the general NIF assigned by the Ministry of the Interior (DNI) coexists with the NIFs assigned in particular cases by the Tax Administration (NIF K and NIF L), in the identification of foreigners, together with the general case in which the NIF is the number assigned by the Ministry of the Interior (NIE), there is a particular case in which the NIF is assigned by the Tax Administration (NIF M).

This particular assumption is included in article 20.2 of the RGAT, which states the following:

“Individuals who lack Spanish nationality and do not have a foreign identity number, either temporarily because they are required to have one or permanently because they are not required to have one, must request the tax administration to assign a tax identification number when they are going to carry out operations of a tax nature or significance. This number will consist of nine characters with the following composition: an initial letter, which will be M, intended to indicate the nature of this number, seven alphanumeric characters and an alphabetical verification character.”

They are not required to have a NIE:

  • Foreigners who are excluded from the scope of Organic Law 4/2000, of January 11, on the rights and freedoms of foreigners in Spain and their social integration.
  • Those who, being included within its scope of application, are not in any of the cases provided for in article 205.1 of the Regulation that develops the Immigration Law, approved by Royal Decree RD1155/2024.
  • EU citizens who will not be staying in Spain for more than three months and are not required to have an NIE under Article 205.1 of the Immigration Regulations.

The following are excluded from the scope of Organic Law 4/2000 (Article 2):

  • Diplomatic agents and consular officials accredited in Spain, as well as other members of permanent or special diplomatic missions and consular offices and their families who, under the rules of International Law, are exempt from the obligations relating to their registration as foreigners and to obtaining a residence permit.
  • Representatives and delegates, as well as other members of Permanent Missions or Delegations to Intergovernmental Organizations based in Spain or to International Conferences held in Spain, as well as their families, according to Organic Law 2/2009 of December 11, amending Organic Law 4/2000 of January 11, on the rights and freedoms of foreigners in Spain and their social integration (BOE December 12).
  • Officials assigned to international or intergovernmental organizations based in Spain, as well as their family members, who are exempt from the obligations mentioned in paragraph a) of this article by the Treaties to which Spain is a party.

Therefore, the NIF M will be definitively assigned to foreigners who prove that they are not required to have a NIE, by means of a certificate issued by the Ministry of the Interior, because they are not included in any of the cases of article 205.1 of the Immigration Regulations when they documentarily prove that they need a tax identification number because they are going to carry out an operation with a tax nature or significance.

Similarly, Article 20.2 of the RGAT provides for the possibility of assigning transitory form The NIF M is issued to foreigners who, being required to have a NIE, have not yet obtained it but need a NIF to carry out a transaction of a tax nature or significance, valid for three months, to prevent economic operations from being hindered simply because the administrative procedures for obtaining the NIE have not been completed. In this case, the foreigner must prove that, although it has not yet been assigned to them, they have applied for the NIE at the General Directorate of the Police and the Civil Guard, or at the Spanish Consular Offices abroad.

The second paragraph of article 20.2 of the RGAT provides for the possibility of assigning the NIF M ex officio in the event that foreigners do not request it.

Furthermore, the NIF M will be assigned to a citizen of the European Union (or of the European Economic Area) who is not resident in Spain or who stays in Spanish territory for less than three months and who is not required to have an NIE because they are not included in any of the cases of article 205.1 of the Immigration Regulation, which is applicable to citizens of the European Union with the same scope as to other foreigners.

The RGAT introduces some NEW FEATURES with respect to the previous regulations (RD 338/1990):

  • Firstly, RD 338/1990 included another special rule for the assignment of NIF to foreigners. It provided that for foreigners under eighteen years of age who did not have a foreigner identity number (NIE), the tax authorities would assign them a number beginning with the letter K, the same as for Spaniards under fourteen years of age. However, the RGAT provides for the assignment of NIF M to foreigners in general, without distinguishing whether or not they are under 18 years of age, leaving NIF K only for Spaniards under 14 years of age and resident in Spain.
  • Secondly, the RGAT eliminates the restriction that prevented the assignment of the NIF M to foreigners residing in Spain. Now, to assign the NIF M, only the nationality of the applicant is taken into account, not his residence.
  • Thirdly, the RGAT allows the NIF M to be assigned not only to those who are not required to have a NIE, but also to those who, although required, have not yet obtained one.

The RGAT maintains that the initial letter indicating the nature of this NIF is M. However, the rest of its composition varies with respect to the previous regulations. Thus, the composition of NIF M would be:

  • According to the repealed Royal Decree 338/1990: the letter M, two digits to indicate the province where the application was made, five digits that form a sequential number within each province, and a verification letter.
  • According to the RGAT: the letter M, seven alphanumeric characters and one alphabetic check character.

Common rules regarding the NIF of natural persons

Article 21.1 of the RGAT states that the NIFs assigned directly by the Tax Administration (NIF K, L or M as seen) will be valid as long as their holder does not obtain their national identity document (DNI) or their personal foreign identification number (NIE).

Those who have a K, L or M type NIE (Foreign National ID) and later obtain a DNI (Spanish National ID) or the NIE (Foreign National ID) will have to communicate this circumstance to the Tax Administration and to the rest of people or bodies who should know about their new NIF (Personal Tax ID) within two months. The previous NIF will be effective up to the date of communication of the new one.

Article 21.3 of the RGAT states:

“When it is detected that a natural person simultaneously has a NIF assigned by the Tax Administration and a national identity document or a foreigner's identity number, the latter will prevail. The tax authorities must notify the interested party of the revocation of the tax identification number previously assigned in accordance with the provisions of article 147, and will inform the interested party of the obligation to communicate their valid number to all persons or entities that must have said number due to their operations.

This would apply in the event that the same individual has a NIF (Tax Identification Number) issued by the Tax Administration (numbers K, L, M, which in some cases will have been assigned ex officio without any request from the individual) and a DNI (National Identity Document) or NIE (Foreigner Identification Number) issued by the General Directorate of the Police, which will prevail over the former.

On the other hand, the RGAT expressly establishes that the NIF K, LM will be valid as long as its holder does not obtain the DNI or the NIE and indicates in articles 19 and 20 that regulate the tax identification numbers of natural persons of Spanish and foreign nationality that: “If they do not request it, the Tax Administration may proceed ex officio to register them in the Register of Taxpayers and assign them the corresponding tax identification number.”

For its part, points 2 and 3 of article 144 of the RGAT indicate that the tax authorities may incorporate ex officio the data that must appear in the census when omissions or inaccuracies in the information contained in the census are revealed, in accordance with the provisions of articles 145 and 146 of the RGAT.

Thus, NIFs K, L and M cease to be valid when a DNI or NIE is available and, as regards DNI/NIE, it is up to the General Directorate of Police to decide on their validity at any given time. All of this, without prejudice to the taxpayer being informed of the official census correction carried out and the obligation to communicate their valid number to all persons or entities to whom said number must be recorded due to their operations.

Attached below is a summary table of the existing types of NIF for natural persons, as well as the competent body that assigns them.

NIF FOR INDIVIDUALS

NATIONALITY

ASSUMPTIONS

NIF TYPE

COMPETENT BODY ASSIGNMENT

Spaniards

General

DNI

Ministry of Interior

Minors under 14 years of age residing in Spain

NIF K

Tax Administration

Foreign residents

NIF L

Tax Administration

Foreigners

General

NIE

Ministry of Interior

That they do not have a NIE, either temporarily or permanently

NIF M

Tax Administration