Free tool
Spanish NIF, NIE and CIF validator
Type a NIE, a Spanish DNI or a company's NIF and see whether the control letter or digit matches and what kind of NIF it is. Whether it actually exists is something only the Spanish Tax Agency (Agencia Tributaria) knows.
Dots, hyphens, lower case and the ES prefix of the NIF-IVA (EU VAT number) are all fine.
Valid format
- Type
- DNI / NIF of a Spanish individual
- Expected control character
- Z
A valid format doesn't mean it exists. A NIF can have the right letter and not be assigned to anyone, or have been deregistered. Only the Spanish Tax Agency (Agencia Tributaria) can confirm that, with its check of a third party's NIF (you need Cl@ve Móvil, an electronic certificate or an electronic DNI).
Everything is calculated in your browser: nothing you type is sent to any server or stored.
How to use it
- 1Type or paste the number. Dots, hyphens, lower case or ES in front are all fine.
- 2You see straight away whether the format is correct, what kind of NIF it is and, for an entity, which legal form its first letter stands for. If the control character doesn't match, we tell you which one it should be.
- 3To check your list of customers or suppliers, use "Several at once": one per line, up to 500, then copy the result into Excel.
Examples
12345678Z: valid DNI
12345678 divided by 23 leaves a remainder of 14, and position 14 (counting from 0) in the table TRWAGMYFPDXBNJZSQVHLCKE is Z.
X1234567L: valid NIE
X counts as 0: 01234567 divided by 23 leaves a remainder of 19, which is L. With Y (1) it would be X, and with Z (2), R.
B1234567: the last character
The digits in odd positions (1, 3, 5, 7) are doubled and their digits added: 2 + 6 + 1 + 5 = 14. The even positions add up to 12. Total 26; 10 minus 6 gives 4: B12345674. As a letter it would be D.
NIF, DNI, NIE, CIF and NIF-IVA: which is which
In Spain every tax ID is called a NIF. What changes is who holds it and how it is built. The formats below are the ones this tool checks.
| Name | What it is | Who has it | Format |
|---|---|---|---|
| NIF | Tax identification number (número de identificación fiscal) | Individuals and entities | The umbrella term: each of the numbers below is a NIF |
| DNI | Spanish national identity card (documento nacional de identidad) | Spanish nationals | 8 digits + letter: 12345678Z |
| NIE | Foreigner identity number (número de identidad de extranjero) | Foreign nationals | X, Y or Z + 7 digits + letter: X1234567L |
| K, L, M | Special NIF | People with neither a DNI nor a NIE | Letter + 7 digits + letter |
| CIF | Old name of the company NIF (código de identificación fiscal) | Companies and other entities | Letter + 7 digits + digit or letter: B12345674 |
| NIF-IVA | EU VAT number | Businesses trading with other EU countries | ES + the NIF: ES12345678Z |
Your own NIF is on every invoice you issue
Aikount checks your company's NIF or CIF when you sign up and when you change it in Settings, and won't save it if the control character doesn't match.
Try AikountFrequently asked questions
What is the difference between NIF, DNI, NIE and CIF?
The NIF (número de identificación fiscal) is your Spanish tax ID. For a Spanish national it is the DNI (national identity card) number with its letter; for a foreign national, the NIE (número de identidad de extranjero, foreigner identity number). Companies and other entities have a NIF that starts with a letter; it used to be called CIF.
Does a valid NIF mean it exists?
No. This tool checks the format and the control character. To find out whether it has been assigned, the Agencia Tributaria has a service to check a third party's NIF for census purposes ("Comprobación de un NIF de terceros a efectos censales"): you enter the NIF and the name or company name and it tells you whether it identifies them. You need Cl@ve Móvil, an electronic certificate or an electronic DNI.
What does the first letter of a company NIF mean?
The legal form, under Orden EHA/451/2008: A public limited company (sociedad anónima), B private limited company (sociedad limitada), F cooperative, G association, H owners' association (comunidad de propietarios), J civil partnership (sociedad civil), N foreign entity, W permanent establishment of a non-resident entity, among others.
Does a company NIF end in a digit or a letter?
The rule only mentions a control character. In practice A, B, E and H end in a digit; N, P, Q, R, S and W in a letter; the rest, either. If you type the less common form we flag it, without marking it as wrong.
What are NIFs that start with K, L or M?
The Tax Agency assigns them to people who have neither a DNI nor a NIE: K to Spanish nationals under 14 living in Spain, L to Spanish nationals living abroad and M to foreign nationals without a NIE.
Official sources
Data checked on 23 September 2026.
- Ministerio del Interior: how the NIF/NIE control letter is calculated (in Spanish)
- BOE: Orden EHA/451/2008, structure of the NIF of legal entities (in Spanish)
- BOE: Real Decreto 1065/2007, arts. 19 to 22, NIF K, L, M and entities (in Spanish)
- Agencia Tributaria: structure of the NIF of individuals
- Agencia Tributaria: checking a third party's NIF for census purposes
More free tools