DNI and NIE Letter Calculator — Spain

Find the control letter of a Spanish DNI or NIE number, or check that a full DNI, NIE or NIF is valid, using the official mod-23 rule.

Free, with no sign-up and no watermark. The file is processed in your browser and never uploaded.

Find the control letter of a Spanish DNI, NIE or K/L/M NIF, or check that a full ID with its letter is correct. The letter comes from the official mod-23 rule: divide the number by 23 and the remainder picks a letter from TRWAGMYFPDXBNJZSQVHLCKE.

For an NIE the leading X, Y or Z is first replaced by 0, 1 or 2.

Step by step

  1. Type the number: Enter 8 digits for a DNI, or X/Y/Z plus 7 digits for an NIE — with or without the final letter.
  2. Read the result: Without a letter you get the correct one; with a letter you’re told whether it matches.

Handy for

Forms and contracts

Check a DNI or NIE before it goes on an invoice, a rental contract or a job application.

Data entry

Catch a mistyped digit — almost any single wrong digit changes the letter.

Good to know

  • Company tax IDs (CIF, starting with A, B, …) use a different check and aren’t covered.

  • The letter confirms the number is well formed, not that the ID belongs to anyone.

Questions

Why is there no letter I, Ñ, O or U?

They were left out of the table to avoid confusion with similar-looking characters.

What are K, L and M NIFs?

Tax numbers for Spaniards under 14 without a DNI (K), Spanish residents abroad (L) and foreigners without an NIE (M). Their letter is worked out the same way as a DNI’s.

Is anything I type sent anywhere?

No. The calculation runs in your browser on your own device; nothing is uploaded or stored, and the page keeps working offline once it has loaded.

More Country IDs, Dates & Holidays tools

  • Working Days Calculator — Count working days between two dates, or add working days to a date, skipping weekends and the public holidays of your country and region.
  • Public Holidays by Country — See every public holiday for a country and year, and print a calendar with ISO week numbers and the holidays marked, as a PDF.
  • Passport Photo Checker — Check a passport or visa photo on your device: pixel size, head height and position, tilt, background evenness and brightness, against your country's rules.
  • Japanese Era Converter — Convert Japanese era years (Reiwa, Heisei, Showa, Taisho, Meiji) to Western years and back, with exact era start dates and an age chart.
  • Korean Age Calculator — Work out your international age (만 나이), traditional Korean counting age and year age from your date of birth, and see which one is used where.
  • Codice Fiscale Calculator — Calculate the Italian codice fiscale from name, sex, birth date and place, check its control letter, or decode an existing code — all on your device.

All Country IDs, Dates & Holidays tools