Skip to content
Aipiter, homeCreate my account

Practical guide

Validate a Spanish tax ID: format and check character

This Spanish tax ID checker tests whether the format and check character are consistent. Use it to catch typing errors before saving invoice details. It can check a DNI, NIE or entity NIF locally in the browser. Confirm who the number belongs to separately with the official tax authority when needed.

Check the Spanish tax ID format

The Aipiter teamPublished Reviewed

Separate a typo from an official tax identity check

If the check character fails, ask for the number again. If it matches and you need to confirm the holder or their tax status, use the relevant official service.

The calculator runs in your browser and does not keep the identifier you enter.

Check the Spanish tax ID format

Your browser checks the identifier without sending or storing it. To confirm who it belongs to, check the Spanish Tax Agency’s register. IDs starting with K, L or M and EU VAT numbers are outside the scope.

Identify the type of number

A DNI has eight digits and a letter. An NIE begins with X, Y or Z. A Spanish entity NIF begins with a letter and ends with a check character.

Check the character before saving

Enter a single Spanish identifier. The calculation runs in the browser and reports an unsupported format or a failed check.

Worked example

Two test entries differ in their final letter

These are illustrative test inputs rather than customer records.

Worked example
ItemExample value
00000000TPasses the checksum
00000000AFails the checksum
OwnershipRequires a separate check

What the check letter confirms

If it fails, check the original document before updating the customer’s record.

Common questions

Can I paste a code with separators?

Spaces and hyphens are accepted when pasting a number. Check the remaining characters against the document.

Does a passing check prove EU VAT registration?

Use VIES to verify intra-EU status.

Check the number against the original document

Confirm a correction with the customer before saving it.

Create my account