DNI Generator - Create valid Spanish IDs for testing

NEW! Now you can generate Spanish IDs from your application using our API. View API documentation →

Our online DNI generator creates valid Spanish IDs for testing and development. Ideal for programmers who need to generate test DNIs or create fake DNI for application testing.

A valid DNI will be generated ending with this letter
Hold Ctrl to select multiple letters

Generated DNI Information

Integrate the DNI generator into your application

Generate DNIs programmatically using our REST API:

PHP


// Generar DNI usando la API
$response = file_get_contents('https://letradni.info/api/generate.php?type=generador-dni');
$dni = json_decode($response)->result;
                

Python


import requests

# Generar DNI usando la API
response = requests.get('https://letradni.info/api/generate.php?type=generador-dni')
dni = response.json()['result']
                

DNI Generator Features

  • ✓ Generates valid DNIs according to Spanish regulations
  • ✓ REST API available for integration
  • ✓ Up to 10 daily generations per IP
  • ✓ Configurable format (with/without spaces)
  • ✓ Automatic letter validation

Need help? Write to us at info@letradni.info

Tool developed following the official specifications of the Spanish DNI, in accordance with the regulations established by the General Directorate of Police and the Ministry of Foreign Affairs.

Generated DNI Information

The generated DNI is technically valid and complies with the official verification algorithm. You can use it for software testing, application development, or any other purpose that requires a sample DNI.

Estructura del DNI

  • 8 numbers: Unique sequential number
  • 1 letter: Verification letter calculated using a specific algorithm

Generator Uses

  • Application and form testing
  • Software development
  • Educational examples
  • Database testing

DNI Verification

Need to check if a DNI is valid? Use our DNI validator to instantly verify any DNI number.

Additional information about DNI

The National Identity Document (DNI) is the official document that proves the identity and Spanish nationality of its holder. For more information about the DNI, you can consult our complete guide about DNI.

The Spanish DNI was created in 1951. Since then, it has evolved through several versions, incorporating increasingly advanced security measures. The current version (DNI 4.0) was introduced in 2015 and includes NFC technology. history of DNI in Spain.

Legal Notice: The generated DNIs are technically valid but fictitious. This generator is designed exclusively for testing and development. It should not be used to impersonate identities or for fraudulent purposes.