Validar NIF, NIE y CIFValidate NIF, NIE and CIF
Comprueba si un documento español está bien formado y calcula la letra del DNI. Todo ocurre en tu navegador: no se envía ni se guarda nada. Check whether a Spanish ID is well-formed and work out the DNI letter. Everything runs in your browser: nothing is sent or stored.
NIF 8 cifras + letra · NIE X/Y/Z + 7 cifras + letra · CIF letra + 7 cifras + control NIF 8 digits + letter · NIE X/Y/Z + 7 digits + letter · CIF letter + 7 digits + control
| Parámetro | ValoresValues | DescripciónDescription |
|---|---|---|
doc | NIF · NIE · CIF | Documento a validar (requerido)Document to validate (required) |
Devuelve JSON con tipo, valido y el control esperado. Límite: 300 peticiones/hora. CORS abierto.Returns JSON with tipo, valido and the expected check. Limit: 300 requests/hour. Open CORS.
Cómo funciona la validaciónHow the validation works
La letra del DNI (que forma el NIF de las personas físicas) se obtiene dividiendo el número de ocho cifras entre 23: el resto señala una letra dentro de la secuencia oficial TRWAGMYFPDXBNJZSQVHLCKE. El NIE hace lo mismo, pero antes sustituye su letra inicial por un número (X = 0, Y = 1, Z = 2). El CIF usa otro método: una suma ponderada de sus siete cifras, de la que sale un dígito de control que, según el tipo de entidad, se expresa como número o como letra.
The DNI letter (which makes up the NIF of individuals) is obtained by dividing the eight-digit number by 23: the remainder points to a letter in the official sequence TRWAGMYFPDXBNJZSQVHLCKE. The NIE does the same, but first replaces its leading letter with a number (X = 0, Y = 1, Z = 2). The CIF uses a different method: a weighted sum of its seven digits, producing a control character that, depending on the entity type, is shown as a number or a letter.
Validar el formato comprueba que el dígito de control encaja, no que el documento exista de verdad. Para generar documentos de prueba válidos, usa el generador de datos falsos españoles. Validating the format checks that the control digit fits, not that the document actually exists. To generate valid test documents, use the Spanish fake-data generator.
Preguntas frecuentesFrequently asked questions
¿Cómo se calcula la letra del DNI?How is the DNI letter calculated?
Se divide el número de 8 cifras entre 23 y el resto indica la letra dentro de la secuencia TRWAGMYFPDXBNJZSQVHLCKE. Esta herramienta lo hace por ti al escribir el número.You divide the 8-digit number by 23 and the remainder gives the letter within the sequence TRWAGMYFPDXBNJZSQVHLCKE. This tool does it for you as you type.
¿Qué diferencia hay entre NIF, NIE y CIF?What's the difference between NIF, NIE and CIF?
El NIF identifica a las personas físicas españolas (DNI más letra). El NIE es el de los extranjeros y empieza por X, Y o Z. El CIF era el código de empresas; su validación sigue vigente aunque oficialmente se integró en el NIF.The NIF identifies Spanish individuals (DNI plus letter). The NIE is for foreigners and starts with X, Y or Z. The CIF was the company code; its validation is still used although it was officially merged into the NIF.
¿Se envían o guardan los datos que escribo?Is what I type sent or stored?
No. La validación ocurre íntegramente en tu navegador con JavaScript. Nada viaja al servidor ni se almacena.No. Validation happens entirely in your browser with JavaScript. Nothing travels to the server or is stored.
¿Validar el formato significa que el documento existe?Does a valid format mean the document exists?
No. Comprobar el dígito de control solo verifica que el documento está bien formado. No confirma que pertenezca a una persona o empresa real.No. Checking the control digit only verifies the document is well-formed. It doesn't confirm it belongs to a real person or company.