For foreigners, the two that matter are N and W. An N number is for a foreign entity without a permanent establishment in Spain (the Amazon FBA seller is a typical case). A W number is for a foreign company operating through a permanent establishment, like a branch or office, on Spanish soil.
The letter never changes the tax function of the number. It is a label, so A12345678 reads as a Sociedad Anónima and B12345678 as a Sociedad Limitada at a glance. Useful when you are checking that a supplier or partner is registered under the legal form they claim.
How to verify a NIF number
To verify a NIF number, use the Agencia Tributaria's official validation service for third parties. Independent calculators can check the control character, but only AEAT confirms the fiscal status behind a number. This matters when you are invoicing a Spanish client or onboarding a partner and need to know the number is real and active.
There are two layers to a check, and people confuse them:
- Format and control character. The final letter or digit is generated by an algorithm, so a free verifier can flag a number that is mathematically impossible. That catches typos, not fraud.
- Fiscal status. Whether a number is genuinely registered and in good standing with the tax authorities is a question only AEAT's own validation service answers. This is the check that protects you on a real transaction.
For intra-EU dealings, there is a third layer. A Spanish operator's intra-community VAT number (the NIF-IVA, your NIF prefixed with ES) can be checked in VIES, the EU-wide system, to confirm a counterpart is registered for cross-border VAT. If a number is not in VIES, the tax administration has not cleared it for those operations.
What the NIF does and does not mean for tax
Holding a NIF or NIE creates tax obligations only when you actually have tax-relevant activity in Spain. The number identifies you. It does not, by itself, make you a tax resident. Getting this wrong costs people real money in over- or under-filing.
Your tax obligations with a NIF depend on what you do, not on owning the number. Three points keep most foreigners out of trouble.
The NIF is not a residency switch. Spanish tax residency for individuals turns on facts: staying in Spain more than 183 days in the calendar year, or having your main base or centre of economic interests in the country. Plenty of foreigners hold a NIE for a property purchase or an inheritance while remaining non-resident for tax purposes. The tax identification number NIF exists so Spain can identify you in dealings with tax relevance in Spain, and nothing more.
Non-resident owners still file. Own a property in Spain as a non-resident and you have an annual non-resident income tax filing (the IRNR, Modelo 210), whether the place is rented or sitting empty. The NIF is what that return runs on.
A normal NIF is not a VAT number. If your business does certain intra-EU operations, you register separately in the ROI (the Register of Intra-Community Operators) through Modelo 036 to obtain the NIF-IVA. Having a NIF does not grant it automatically.
Common mistakes
Most NIF problems trace back to five wrong assumptions. Clear them and the process gets short.
"Spain has a NIF like Portugal." Different doors. In Portugal a foreigner often requests a NIF directly. In Spain a foreigner usually needs a NIE, and that NIE becomes the NIF.
"NIE and NIF are two separate numbers for me." Usually they are the same number wearing two hats. For a foreign individual, the NIE is the NIF.
"The NIF M is permanent." It is temporary, valid until you get a DNI or NIE, and you have two months to report the new number once you do.
"A NIE means I can live in Spain." It does not. The NIE identifies you. Living rights come from EU registration, a visa, a residence authorisation, or a TIE, depending on your case. A number is not a permit.
"My NIF-IVA is automatic." It is not. Intra-EU VAT operations need ROI registration through Modelo 036, and then you appear in VIES.