Skip to contentCalcsmiths

Spanish NIF, NIE, CIF and IBAN validator and generator

Validate a Spanish NIF, NIE, CIF or IBAN: detects the type, says whether it is valid, why not (with the correct control letter) and formats it. Validates lists and generates valid test data for developers.

Validate one value

Valid · DNI / NIF

Formatted: 12345678Z

Validate a list

5 values, 4 valid.

ValueTypeResult
12345678ZDNI / NIFValid
X1234567LNIEValid
A58818501CIFValid
ES91 2100 0418 4502 0005 1332IBAN (ES)Valid
12345678ADNI / NIFThe control character is wrong. It should be: Z.

Test data generator

Test data: not real people or accounts.

Values are random and only satisfy the structure and control digits: they may coincide with real ones. Use them only in test environments.

How they are checked

DNI and NIE carry a control letter: the number modulo 23 indexes TRWAGMYFPDXBNJZSQVHLCKE (for a NIE, X, Y, Z count as 0, 1, 2). A CIF adds the digits in even positions and the digits of twice the odd ones; the control is the complement to 10, as a digit or letter depending on the entity type. A Spanish IBAN is checked with mod 97 and with the two account control digits. Everything is computed in your browser; nothing is sent anywhere.

Everything is calculated in your browser: this site doesn't send what you type anywhere.