PAIM PAPYR

Guide updated 11 July 2026

NIF, CIF and NIE: the letter is not decorative

The check letter or digit exists to catch transcription errors before they reach a contract, an invoice or a tax return. This is how it works, and how to check it in seconds.

How it is calculated

In the NIF of an individual, the letter comes from the remainder of dividing the number by 23, applied to the official table of 23 letters (TRWAGMYFPDXBNJZSQVHLCKE). In the NIE, the initial letter (X, Y, Z) is replaced by 0, 1 or 2 and the same calculation is applied. In the CIF of entities, the check is a digit or a letter that depends on the legal form and on a weighted sum of the digits. One swapped number and the check no longer matches: that is what it is for.

Typical errors that validation catches

Transpositions when typing (12345678 instead of 12354678), leading zeros dropped, NIE letters wrongly substituted, and CIFs with a check letter where a digit was due (or the other way round) depending on the legal form. In customer databases it is common to find between 1% and 5% of identifiers that fail the check.

What PAPYR checks, and what it does not

The tool validates the format and the check of NIF, CIF and NIE instantly, all calculated locally: no register is consulted and nothing leaves your browser for third parties. To be honest: a matching check means the identifier is formally valid, not that it exists or belongs to whoever claims it. Checking the tax census is a different matter and is for the AEAT.

Frequently asked questions

Can a NIF with the correct letter be fake?

Yes. The letter confirms that the number has been transcribed correctly, not that it is assigned to a real person. For a census check, the procedure is with the AEAT.

Does PAPYR store the NIFs I validate?

No. The check is a local calculation with the official table; nothing is stored or sent to third parties.

Does it also validate batches?

To validate identifiers inside invoices, Facturae validation automatically checks the NIF of issuer and recipient. For mass batches in Excel, write to us: it is exactly the kind of case our API exists for.

Related free tools

Other guides

Open AIM PAPYR for free