nokfi
Sign in

Spanish NIF, NIE and CIF validator

Before you issue an invoice in Spain, check that your client’s tax ID is correct. A wrong NIF can stop your invoice from being valid for VAT deduction.

Updated October 2026

It checks the format and the check character. It does not look up whether the ID is registered with the tax office or in VIES.

Calculated in your browser: nothing is sent or stored. Estimate for the general regime (mainland Spain and the Balearic Islands). It does not replace professional advice.

How the DNI letter is calculated

Divide the number by 23; the remainder picks the letter from the sequence TRWAGMYFPDXBNJZSQVHLCKE. For example, 12345678 divided by 23 leaves 14, which is Z: 12345678Z.

NIE and CIF

The NIE for foreign nationals starts with X, Y or Z, which are replaced by 0, 1 and 2 to calculate the letter in the same way as the DNI.

The tax ID of companies (formerly CIF) starts with a letter for the type of entity (B for an SL, A for an SA…), followed by seven digits and a check digit or letter.

What it does not check

A correct NIF does not mean it exists or is registered. For transactions within the EU, check the VAT number in the European Commission’s VIES database.

Frequently asked questions

How do I know if a Spanish NIF is valid?

Enter it in the validator: it checks the format and that the check letter or digit matches the rest of the number.

Does the CIF still exist?

Since 2008 it is called NIF for companies too, but the format is the same and many people still call it CIF.

What is the EU VAT number of a Spanish company?

Its NIF with the ES prefix (for example, ESB12345674). To use it for intra-EU transactions, the company must be in the intra-community operators register (ROI).

Related guides

More free tools