Skip to main content
Check Digit Calculator
Government

Spanish NIF Check Letter Calculator

Calculate the check letter for a Spanish NIF or DNI number. Divide the eight-digit payload by 23 and use the remainder lookup table.

Last updated:

Government & Identity Numbers

Calculate tax identifier control letters.

Length: 10 chars
Calculated Check Character / Checksum
--Ready
Complete Validated Sequence:
--
Arithmetic Steps & Mathematical Specification

Initialising algorithm engine for Spanish NIF Check Letter Calculator...

How Spanish NIF Check Letter Calculator Works?

The Spanish NIF Check Letter Calculator divides the 8-digit DNI number by 23. It uses the remainder as a position in the letter table TRWAGMYFPDXBNJZSQVHLCKE.

  1. 1Enter the 8 digits of the Documento Nacional de Identidad (DNI) number.
  2. 2Compute the remainder modulo 23.
  3. 3Take the letter at that position (0-based) in TRWAGMYFPDXBNJZSQVHLCKE.
  4. 4Append the letter to the 8 digits.

Spanish NIF Check Letter Calculator Formula

The NIF formula is Letter = TRWAGMYFPDXBNJZSQVHLCKE[N mod 23].

r = N mod 23
Letter = "TRWAGMYFPDXBNJZSQVHLCKE"[r]
  • N is the 8-digit DNI number.
  • The table omits I, Ñ, O, and U.
Worked example: 12345678
12345678 mod 23 = 14
Letter at position 14 = Z
NIF = 12345678Z

Spanish NIF Check Letter Calculator Conversion Table

The NIF conversion table maps all 23 remainders to their control letter.

RemainderLetterRemainderLetterRemainderLetter
0T8P16Q
1R9D17V
2W10X18H
3A11B19L
4G12N20C
5M13J21K
6Y14Z22E
7F15S

What is Spanish NIF Check Letter Calculator?

A Spanish NIF Check Letter Calculator is a tool that computes the control letter of a Spanish Número de Identificación Fiscal (NIF) for individuals. For Spanish nationals, the NIF equals the DNI number plus its letter.

The modulus 23 letter detects all single-digit errors and all adjacent transpositions in the 8 digits.

What are the uses of Spanish NIF Check Letter Calculator?

There are 3 main uses of the Spanish NIF Check Letter Calculator, including invoices, tax forms, and online registration.

  • Invoices: Spanish invoices must show a valid NIF for both parties.
  • Tax forms: Accountants check NIFs on Agencia Tributaria forms.
  • Online registration: Websites validate DNI letters at sign-up.