The DNI of Spain. This page is generated from the registry metadata of the library.
| Property | Value |
|---|---|
| Country code | ESP, ES |
| ID type | DNI |
| Official name | Documento Nacional de Identidad (DNI) |
| Also known as | Documento Nacional de Identidad; DNI |
| Display format | ########L |
| Input masks | ########L |
| Length | 9 |
| Example | 12345678Z |
| Checksum | yes |
| Checksum algorithm | Mod-23 check letter (TRWAGMYFPDXBNJZSQVHLCKE) |
| Parsable | no |
The root entry registers every country:
import { validateNationalId } from 'idnumbers';
validateNationalId('ESP', '12345678Z').isValid; // true
To bundle only this country, import its definition from idnumbers/countries/esp and pass it to register():
import { register, validateNationalId } from 'idnumbers/core';
import { country } from 'idnumbers/countries/esp';
register(country);
validateNationalId('ESP', '12345678Z').isValid; // true