Spanish NIF, NIE and CIF checker.
In Spain every person and company has a tax ID, the NIF: Spaniards use their DNI, foreigners their NIE, and companies a NIF still called CIF. Type one to see which it is, whether its check character matches and which one it should have.
Check result
Valid DNI: the letter matches.
- 12345678Number
- ZCheck
- TypeThe tax ID of a Spanish national, from their identity card.
- DNI
- Without separators
- 12345678Z
- As an EU VAT numberOnly valid in VIES if it is on the register of intra-EU operators (ROI).
- ES12345678Z
An estimate under 2026 rules. Your case may have details that change it, so check before you decide. Calculated in your browser: nothing you type is sent or stored.
How it is calculated.
We clean the number.
Spaces, dots and hyphens go, and so does the ES prefix of an EU VAT number. A NIF has 9 characters.
We see which kind it is.
A number first means a DNI; X, Y or Z means an NIE. One of the letters in Orden EHA/451/2008 means a company or other entity (the old CIF), and the letter gives its legal form.
The DNI and NIE letter.
The number is divided by 23 and the remainder picks the letter from TRWAGMYFPDXBNJZSQVHLCKE. In an NIE, X, Y and Z count as 0, 1 and 2.
A company’s check character.
Of its seven digits, those in even positions are added, and those in odd positions are doubled with the digits of each double added. The check is what is left to the next ten, as a digit, a letter or either, depending on the kind of entity.
Would you rather Melso did it?
Your agent gathers invoices and expenses on WhatsApp, and your advisors prepare and file your taxes after you approve them in the app.
What people ask us most.
The DNI number is divided by 23 and the remainder, from 0 to 22, picks the letter from TRWAGMYFPDXBNJZSQVHLCKE. For example, 12345678 divided by 23 leaves 14, which is Z.
The same, with the first letter swapped for a digit: X for 0, Y for 1 and Z for 2. So X1234567 is worked out as 01234567, which gives L.
The entity’s legal form: A is a public limited company (S.A.), B a limited company (S.L.), E a comunidad de bienes, F a cooperative, G an association and N a foreign entity, among others. Its official name today is NIF, though people still say CIF.
No. The checker confirms the number is well formed and its check character matches, not that it is registered with Hacienda, Spain’s tax agency. With the ES prefix it only works as an EU VAT number if its holder is on the register of intra-EU operators.
Hacienda gives those to children under 14 (K), Spaniards living abroad (L) and foreigners without an NIE (M). This tool does not check them.
Leave the maths to your tax advisor.
Tell us about your situation. We confirm the scope before work starts.