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

12345678Z
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

  1. 1Type or paste the number. Dots, hyphens, lower case or ES in front are all fine.
  2. 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.
  3. 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.

NameWhat it isWho has itFormat
NIFTax identification number (número de identificación fiscal)Individuals and entitiesThe umbrella term: each of the numbers below is a NIF
DNISpanish national identity card (documento nacional de identidad)Spanish nationals8 digits + letter: 12345678Z
NIEForeigner identity number (número de identidad de extranjero)Foreign nationalsX, Y or Z + 7 digits + letter: X1234567L
K, L, MSpecial NIFPeople with neither a DNI nor a NIELetter + 7 digits + letter
CIFOld name of the company NIF (código de identificación fiscal)Companies and other entitiesLetter + 7 digits + digit or letter: B12345674
NIF-IVAEU VAT numberBusinesses trading with other EU countriesES + 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 Aikount

Frequently 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.

More free tools

Cookies & privacy

We use our own cookieless analytics. With your permission, we measure registrations and payments from Google and ChatGPT ads. Learn more · Privacy