Online Spanish ID Generator - Create valid DNIs for testing

The most complete and reliable Spanish ID generator for developers. Generate valid test DNIs, NIFs, CIFs, NIEs and IBAN bank accounts for free.

NEW! NEW! Our REST API for developers is now available. Generate DNIs and other documents directly from your application.

DNI Generator

Generate valid test DNIs instantly. Ideal for:

  • Application testing
  • Software development
  • Form testing
  • Sample databases
Generate DNI

Bank Account Generator

Create valid IBANs for bank testing:

  • Spanish and European IBANs
  • Automatic validation
  • International format
  • Multiple countries available
Generate IBAN

API for Developers

Integrate our DNI generator into your application with examples in various languages:

PHP - Generate DNI


// Generate DNI using our API
$api_url = 'https://letradni.info/api/generate.php?type=generador-dni';
$response = file_get_contents($api_url);
$data = json_decode($response, true);
$dni = $data['result'];
echo "Generated DNI: " . $dni;
                

Python - Generate DNI


import requests

# Generate DNI using our API
url = "https://letradni.info/api/generate.php"
params = {"type": "generador-dni"}
response = requests.get(url, params=params)
dni = response.json()["result"]
print(f"Generated DNI: {dni}")
                

C# - Generate DNI


// Generate DNI using our API
using (var client = new HttpClient())
{
    var response = await client.GetAsync(
        "https://letradni.info/api/generate.php?type=generador-dni"
    );
    var result = await response.Content.ReadAsStringAsync();
    var dni = JsonDocument.Parse(result).RootElement
        .GetProperty("result").GetString();
    Console.WriteLine($"Generated DNI: {dni}");
}
                

Why use our generator?

  • Instant generation of valid DNIs
  • Automatic verification of the control digit
  • Up to 10 daily calls per IP
  • REST API available for integration
  • Support for multiple document types

Need help?

Write to us at info@letradni.info and we will respond as soon as possible.

Frequently Asked Questions

Are the generated DNIs real?

No, they are random DNIs with valid format but do not correspond to real people. They are perfect for software testing.

Can I use these DNIs in real applications?

Yes, but only for testing and development. They should not be used to impersonate identities or in official documents.

How is the DNI letter calculated?

The letter is calculated by dividing the number by 23 and assigning a letter according to the remainder of the division, following an official table.

More questions

Check all FAQs