Spain CIF validator
How the CIF format works
- Format
- Entity letter + 7 digits + 1 control character (a digit, or a letter A–J)
- Example
- A28015865
Things to watch for
- The first letter encodes the legal form (for example A = sociedad anónima, B = sociedad limitada, G = association or foundation); the control character may be printed as a digit or as its letter equivalent (J, A–I) — both forms are accepted
- Since 2008 Spanish companies formally hold a NIF (Número de Identificación Fiscal), but the CIF layout and control character are unchanged and 'CIF' is still the everyday name
- Checksum only — a pass doesn't confirm the company is registered with the Agencia Tributaria or still active
^[ABCDEFGHJNPQRSUVW][0-9]{7}[0-9A-J]$A CIF (Código de Identificación Fiscal) is the tax identification code Spain’s Agencia Tributaria assigns to companies and other legal entities. It’s made up of one entity letter, seven digits and a final control character, for example A28015865. Since 2008 it has formally been the entity’s NIF, but the structure is unchanged, and Spanish invoices, contracts and supplier forms still widely label it “CIF”.
Reading the letter and the digits
The opening letter must be one of 17 entity letters (A–H, J, N, P–S, U–W), each standing for a legal form. X, Y and Z belong to the personal NIE system, so a number starting with them isn’t a CIF. Traditionally the two digits after the letter are a province code and the next five a serial number. This tool doesn’t check the province code, only the control character.
How the control character is calculated
Take the seven digits. Double the 1st, 3rd, 5th and 7th, subtracting 9 from any result above 9, then add those results to the 2nd, 4th and 6th digits. The control digit is whatever brings that total up to the next multiple of 10, or 0 if the total already ends in 0. For A28015865, the doubled digits contribute 8 and the others 17, a total of 25. So the control is 5, which can also be written as the letter E. Both A28015865 and A2801586E pass.
What a pass doesn’t tell you
A pass means the control character is consistent with the seven digits. It doesn’t confirm that the entity exists, is registered with the Agencia Tributaria, or is still trading. A Spanish company’s VAT number is normally ES followed by its CIF, which you can check with the Spain VAT number validator. For personal numbers, use the Spain DNI / NIE validator.
Scope: Spanish CIF/NIF format and control-character validation only. It doesn’t cover registration, VAT or trading status.
Content last reviewed 2026-10-11.
CIF FAQ
Is a CIF the same as a NIF?
For companies, yes. Since 2008 the official name for a Spanish legal entity's tax number is NIF (Número de Identificación Fiscal), but the layout didn't change: an entity letter, seven digits and a control character. 'CIF' is still the everyday term, and this tool validates the number under either name.
Why does the same CIF sometimes end in a letter and sometimes in a digit?
The control character can be written as a digit or as its letter equivalent: 0 becomes J, 1 becomes A, 2 becomes B, and so on up to 9 = I. Published sources disagree on which entity types must use which form, so this validator accepts both forms for every entity letter.
How is a CIF different from a DNI or NIE?
A CIF identifies a legal entity, such as a company, association or public body, and starts with a letter showing its legal form. Individuals use a DNI (Spanish nationals) or an NIE (foreign residents), which end in a mod-23 check letter instead of the Luhn-style control used by the CIF.