Spanish DNI, NIE and NIF Validator (and Letter Calculator)

Check whether a Spanish DNI, NIE or NIF has a valid format and control letter/digit, or calculate the control letter of a DNI or NIE from its digits. This only validates or calculates structure — it never checks any registry or confirms the document actually exists.

Local processing: your data is processed in your browser and never sent to Numelto or any external service.

Which document types this validates

An individual's NIF is always the same as their DNI or NIE. A legal entity's NIF (sometimes still called CIF) uses a different algorithm, with a control character that depends on the organization type.

DocumentFormatWho has it
DNI8 digits + letterSpanish citizens
NIEX/Y/Z + 7 digits + letterForeign residents in Spain
Company NIF (CIF)Letter + 7 digits + control letter or digitLegal entities (companies, associations...)

How the control letter/digit is calculated

For DNI and NIE, the letter comes from dividing the number by 23 and looking up the remainder in a fixed 23-letter table. For a company NIF, the control digit or letter is derived from the 7 central digits, following an algorithm that depends on whether the first letter identifies a public company, a limited company, an association...

What this tool does NOT check

A valid format doesn't mean the document exists, is currently active, or belongs to a specific person or company. Confirming that would require checking the electronic DNI, the Civil Registry or the Commercial Registry — none of which this tool does or can do.

Privacy

Whatever you type never leaves your browser: it's not sent to Numelto, not logged, and not stored anywhere.

Frequently asked questions

Related tools

We use analytics cookies to understand which calculators are useful. They are never used for advertising. More information in our privacy policy.