# Company CIF in Spain: what it is, its format, and how to check it

URL: https://melso.ai/en/blog/company-cif-number-spain
Published: 2026-11-24 · Updated: 2026-11-24

A company CIF is the former name for its NIF: legislation in force since 1 January 2008 refers only to the tax identification number. It has a legal form letter, seven digits, and a check character.

## A company's CIF, in brief

A company's CIF is that company's NIF: the tax identification code regulated by Decree 2423/1975 was repealed by [Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#ddunica), in force since 1 January 2008, which regulates the tax identification number of legal persons and entities. "CIF" is still used in everyday language to refer to a company's NIF.

> [!RESUMEN]
> - The CIF was the tax identification code for legal persons and entities: Decree 2423/1975 was repealed by Royal Decree 1065/2007, in force since 1 January 2008.
> - The NIF of a legal person or entity has nine characters: a legal form letter, seven digits and a control character.
> - In Spanish entities, the letter B identifies limited liability companies and A identifies public limited companies; there are codes for cooperatives, associations or communities of property (comunidades de bienes), among others.
> - The NIF of a legal person does not change unless its legal form or its nationality changes.
> - An individual autónomo (self-employed worker) does not have a separate NIF for their activity: if they have Spanish nationality, it is their DNI number with its verification letter.

## What a company's CIF is and why people talk about NIF today

The CIF (tax identification code) was the code used to identify legal persons and entities in general. It was regulated by Decree 2423/1975. That decree was repealed by Royal Decree 1065/2007, which entered into force on 1 January 2008 and regulates the tax identification number of legal persons and entities, according to its [sole repealing provision](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#ddunica).

Today the regulation speaks only of NIF (tax identification number). "CIF" continues to be used in everyday language to refer to a company's NIF. When someone asks for "the company's CIF", they are asking for that NIF.

![The CIF identified legal persons and entities and was regulated by Decree 2423/1975, now repealed. The NIF identifies natural persons, legal persons and entities without legal personality and is regulated by Royal Decree 1065/2007, currently in force.](https://storage.googleapis.com/albert-489117-melso-blog-media/diagrams/en/cif-empresa/1-compare-08638ecb12.png?w=1600&h=964&m=1&mw=1080&mh=1452 "CIF and NIF, side by side")

The NIF is not exclusive to companies. Natural persons, legal persons and entities without legal personality have a NIF for their tax-relevant relations, as stated in [Article 18.1 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a18).

> [!IMPORTANTE]
> The CIF is not a different number from the NIF. It is the name people still use for the same identifier: if an invoice, a contract or a form asks for a company's CIF, you have to provide its NIF.

## What a company's NIF looks like: letter, seven digits and control character

The NIF of a legal person or entity has nine characters, according to [Article 2 of Order EHA/451/2008](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a2). The structure is divided into three parts: a letter, a seven-digit number and a control character. The sum of the three gives 1 + 7 + 1 = 9 characters.

The letter is not random: it indicates the legal form if it is a Spanish entity (or the status of a foreign entity or permanent establishment of a non-resident entity). The seven digits are random in numbers assigned under this order, in force since 1 July 2008. A client may retain a NIF formed under the previous system. The control character completes the sequence; we do not explain how it is calculated here.

## What each letter of a company's NIF means

In Spanish entities, the first character of the NIF indicates its legal form. The codes are set out in [Article 3 of Order EHA/451/2008](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a3).

| Letter | Legal form in Spanish entities |
|---|---|
| A | Public limited companies |
| B | Limited liability companies |
| C | General partnerships |
| D | Limited partnerships |
| E | Communities of property (comunidades de bienes), undivided estates and other entities without legal personality not included in other codes |
| F | Cooperatives |
| G | Associations |
| H | Homeowners' associations |
| J | Civil companies (sociedades civiles) |
| P | Local corporations |
| Q | Public bodies |
| R | Religious congregations and institutions |
| S | Bodies of the State Administration and the autonomous communities |
| U | Temporary joint ventures |
| V | Other undefined types |

A NIF starting with B corresponds to a limited liability company; one starting with A, to a public limited company. Foreign entities and permanent establishments of non-resident entities have other codes, which we do not detail here. If you are hesitating between working for yourself or setting up a limited company (letter B), you can read [autónomo or limited company](/en/blog/autonomo-or-sl-spain).

The codes P, Q, R and S do not identify commercial companies: they correspond to local corporations, public bodies, religious congregations and institutions, and bodies of the State Administration and autonomous communities.

Code E deserves a separate mention. It groups communities of property (comunidades de bienes), undivided estates and other entities without legal personality that are not included in another code. That is, entities that are not companies, but which also have a NIF for their tax-relevant relations.

## How a company gets its NIF: provisional and permanent

Legal persons and entities that are going to carry out business or professional activities must apply for a NIF before any delivery, supply or acquisition of goods or services, collection, payment or hiring of staff for their activity. And, in any case, within the month following their incorporation ([Article 23 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a23)).

### The steps, in order

1. **Application.** The company submits a single application for a NIF before carrying out any of those transactions and, in any case, within the month following its incorporation.

2. **Provisional NIF.** The NIF is provisional as long as the entity does not provide a copy of the notarial deed (escritura) or authentic document of incorporation and the bylaws, and the certificate of its registration in a public registry when applicable ([Article 24.2 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a24)).

3. **Pending documentation and permanent NIF.** With a provisional NIF, the entity must submit the pending documentation within one month of registration in the relevant public registry. The permanent NIF is requested with a census amendment declaration ([Articles 24.3 and 24.4 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a24)).

> [!MELSO]
> If you are going to set up an S.L. (Spanish limited company), on the [incorporate an S.L.](/en/tramites/constituir-sl) page you have the steps and Melso's service.

### The number does not change, its status changes

Provisional and permanent are not two different numbers: it is the same NIF in two different situations. What changes is its status, not the characters that make it up.

Nor does it change for other reasons. The NIF of a legal person is invariable whatever changes it undergoes ([Article 22.1 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a22)). The exception is a change of legal form or nationality. Changing partners or the company name does not alter the number.

If you are considering creating one, in [limited company](/en/blog/sociedad-limitada-guide-spain) we review what it is and how it works.

## The NIF-IVA: the same number with ES in front

For intra-Community transactions there is the NIF for VAT purposes, known as NIF-IVA. According to [Article 25 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a25), it is the NIF with the prefix ES. It is not a different number: the company's letter and digits remain, and the prefix ES is placed in front.

The NIF-IVA is assigned when inclusion in the Register of intra-Community operators is requested. The application starts the process: it is the tax authority that assigns it following that application, it is not obtained merely by requesting it.

The prefix ES identifies the Spanish NIF-IVA. This number does not change the general identification of the company: it adds the country prefix when it comes to intra-Community transactions. You can also read [VAT number Spain](/en/blog/vat-number-spain).

## Where to see a company's NIF and how to check it before invoicing

The NIF is proven with the document issued by the tax administration for its record, according to [Article 18.2 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a18). That document is what you can ask a new client for to verify the number before issuing the invoice.

On a full invoice, the NIF of the issuer is mandatory and, in the cases of Article 6.1.d (for example, when the invoice issuer is established in Spain and the transaction is located here), also that of the recipient, according to [Article 6 of the Invoicing Regulations](https://www.boe.es/buscar/act.php?id=BOE-A-2012-14696#a6). Simplified invoices are governed by Article 7. Regarding the rest of the document's content, you can read [how to make an invoice](/en/blog/how-to-invoice-self-employed-spain).

### How to check the NIF a client gives you

![Four steps to check a company's NIF: ask for the supporting document, count the nine characters, check that the first letter corresponds to its legal form if it is a Spanish entity, and check the seven digits and the control character.](https://storage.googleapis.com/albert-489117-melso-blog-media/diagrams/en/cif-empresa/2-steps-cb82105f5f.png?w=1600&h=854&m=1&mw=1080&mh=1608 "How to check a company's NIF in four steps")

Asking for the document is not enough: check that the data match. The number must have nine characters, with a letter indicating the legal form if it is a Spanish entity, seven digits and a control character, according to [Articles 2 and 3 of Order EHA/451/2008](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a3).

To perform that check, you can use the [NIF validator](/en/herramientas/validador-nif), although the reference remains the supporting document issued by the tax administration.

If what you are going to send before the invoice is a document with prices and terms, see [proforma invoice](/en/blog/proforma-invoice-guide-spain): what it is and what value it has.

## And if you are an autónomo: your NIF is that of your DNI or NIE

An autónomo does not have a separate NIF for their activity. For natural persons with Spanish nationality, the NIF is the DNI number followed by the verification letter; for natural persons without Spanish nationality, it is, generally, the foreigner identity number, NIE ([Articles 19 and 20 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a19)).

On your invoices, that NIF appears as the issuer and, in the cases of Article 6.1.d, also that of the recipient. You have more on both documents in [NIF and DNI: is it the same?](/en/blog/nif-dni-difference-nie-tie-spain).

When registering as an autónomo you do not receive a new number; what you do choose is the heading for your activity, which we explain in [IAE headings](/en/blog/iae-headings-autonomo-spain).

## Example: a broken-down NIF and the invoice that carries it

The fictional NIF B12345678 follows the composition in [Article 2 of Order EHA/451/2008](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a2): one letter, seven digits and a control character. The B corresponds to a limited liability company. The seven digits are 1234567. The 8 is the control character, fictional in this example; we do not explain how it is calculated. The total is 1 + 7 + 1 = 9 characters.

A professional female autónoma invoices that S.L. The invoice carries the NIF of both parties: that of the autónoma, which is that of her DNI with its letter ([Article 19 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a19)), and that of the company, B12345678. [Article 6.1.d of the Invoicing Regulations](https://www.boe.es/buscar/act.php?id=BOE-A-2012-14696#a6) requires the NIF of the person issuing the invoice and, when the issuer is established in Spain and the transaction is located here, also that of the recipient. That situation explains why the invoice in the example carries both NIFs.

> [!EJEMPLO]
> Invoice from a professional autónoma to S.L. B12345678:
> Taxable base: €2,000.
> IVA (Spanish VAT) at 21%: 2,000 × 21% = €420.
> Withholding at 15%: 2,000 × 15% = €300.
> Total: 2,000 + 420 - 300 = €2,120.

![Base of 2,000 euros, plus 420 euros of VAT at 21%, minus 300 euros of withholding at 15%: total of 2,120 euros.](https://storage.googleapis.com/albert-489117-melso-blog-media/diagrams/en/cif-empresa/3-breakdown-92cbc12be4.png?w=1600&h=792&m=1&mw=1080&mh=1257 "Illustrative example with fictional figures.")

## Common mistakes when using a company's CIF

### Treating the CIF as a different number from the NIF

The CIF was the tax identification code for legal persons and entities regulated by Decree 2423/1975, repealed by Royal Decree 1065/2007, in force since 1 January 2008. Today the regulation speaks only of NIF and "CIF" is used in everyday language. For a natural person with Spanish nationality, the NIF is their DNI number with its letter ([NIF and DNI: is it the same?](/en/blog/nif-dni-difference-nie-tie-spain)).

### Believing that the NIF changes if partners or company name change

[Article 22.1 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a22) establishes that the NIF of a legal person is invariable whatever changes it undergoes. The exception is a change of legal form or nationality.

### Thinking that the provisional and permanent NIF are different numbers

The NIF is provisional as long as the entity does not provide a copy of the notarial deed or authentic document of incorporation and the bylaws, and the certificate of its registration in a public registry when applicable, according to [Article 24.2 of Royal Decree 1065/2007](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a24). The number is the same: what changes is its status.

### Issuing the invoice without the recipient's NIF

On a full invoice, the NIF of the issuer is mandatory and, in the cases of Article 6.1.d, also that of the recipient, according to [Article 6 of the Invoicing Regulations](https://www.boe.es/buscar/act.php?id=BOE-A-2012-14696#a6). For the rest of the mandatory content, you can read [how to make an invoice](/en/blog/how-to-invoice-self-employed-spain).

## How Melso helps

Melso is your online gestoría (a private firm that handles tax and administrative paperwork), with an AI agent and human professionals behind it, and day-to-day communication takes place via WhatsApp, Telegram, email and web.

It includes your autónomo registration, your invoices with VERI*FACTU and the quarterly tax returns for your profile (modelos 303 and 130, among others) and Renta (annual income tax return, modelo 100), with a professional reviewing every return.

The Melso Pro plan costs €49 a month or €490 a year, with no lock-in, and Melso's errors in an included return filed by Melso are covered up to €30,000 a year in surcharges (recargos), penalties and late-payment interest, without covering the tax itself.

The next step is to review the plan and get started at [Melso Pro for autónomos](/en/precios/autonomos).

> This article is for information only and does not replace professional advice for your case. Last reviewed: 24 November 2026.

## Frequently asked questions

### Are a company's CIF and NIF the same thing?

Today the legislation refers only to the NIF. The CIF (código de identificación fiscal) was the code regulated by Decree 2423/1975 for legal persons and entities. That decree was repealed by Royal Decree 1065/2007, in force since 1 January 2008, which regulates the tax identification number (NIF) of legal persons and entities. 'CIF' continues to be used in everyday language for a company's NIF.

### What does the letter of a company's CIF mean?

In the NIF of a Spanish entity, the first letter indicates its legal form (Order EHA/451/2008, in force since 1 July 2008). A is a public limited company (sociedad anónima); B, a private limited company (sociedad de responsabilidad limitada); C, a general partnership; D, a limited partnership; F, a cooperative; G, an association; H, a community of property owners; J, a civil company (sociedad civil). Seven random digits and a check character complete the NIF.

### Can a company's NIF change if its name or partners change?

The NIF of a legal person is unalterable regardless of any changes it undergoes, unless its legal form or its nationality changes (Article 22.1 of Royal Decree 1065/2007). A change of name or partners is not among those exceptions, so the number remains the same. The NIF serves for the entity's relations with tax relevance.

### What is the difference between a company's provisional NIF and definitive NIF?

The NIF is provisional as long as the entity does not provide a copy of the public deed or authentic incorporation document and bylaws, and the certificate of its registration in the public registry where applicable. With a provisional NIF, the entity must submit the pending documentation within one month of registration in the corresponding public registry, and the definitive NIF is requested with a census modification return. The number is the same: its status changes.

### Which NIF must an invoice include?

On a full invoice, the NIF of the issuer is mandatory and, in the cases set out in Article 6.1.d of the Invoicing Regulations, also that of the recipient. That case arises, for example, when the issuer is established in Spain and the transaction is located here, as in an invoice to a Spanish limited company. An invoice from an autónoma (self-employed worker) to a Spanish limited company bears the NIF of both parties.

### Which NIF does an autónomo use?

An autónomo (self-employed worker) does not have a separate NIF for their business activity. For individuals with Spanish nationality, the NIF is their DNI number followed by the verification letter (Article 19 of Royal Decree 1065/2007). For individuals without Spanish nationality, it is, in general, the foreigner identity number (NIE) (Article 20).

### What is the NIF-IVA and when is it used?

The NIF for value added tax purposes (NIF-IVA) is the one used for intra-Community transactions. It consists of the NIF with the prefix ES and is assigned when applying for inclusion in the Register of intra-Community operators (Article 25 of Royal Decree 1065/2007). It is assigned by the tax authorities following that application: it is not obtained merely by requesting it.

## Sources

- [Royal Decree 1065/2007, Article 18 (obligation to hold a NIF)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a18), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, sole repealing provision and third final provision](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#ddunica), BOE, accessed 2026-11-24
- [Order EHA/451/2008, Article 2 (composition of the NIF of legal persons and entities)](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a2), BOE, accessed 2026-11-24
- [Order EHA/451/2008, composition of the NIF of legal persons and entities (Articles 2 and 3)](https://www.boe.es/buscar/act.php?id=BOE-A-2008-3580#a3), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, Article 22 (NIF of legal persons and entities)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a22), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, Article 23 (application for the NIF of legal persons)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a23), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, Article 24 (assignment of the NIF: provisional and definitive)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a24), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, Article 25 (NIF for VAT purposes)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a25), BOE, accessed 2026-11-24
- [Invoicing Regulations, Article 6 (invoice content)](https://www.boe.es/buscar/act.php?id=BOE-A-2012-14696#a6), BOE, accessed 2026-11-24
- [Royal Decree 1065/2007, Articles 19 and 20 (NIF of individuals)](https://www.boe.es/buscar/act.php?id=BOE-A-2007-15984#a19), BOE, accessed 2026-11-24
