Spain CIF Validator

Check the control character of a Spanish company tax ID (CIF) instantly.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

The Spanish CIF (Código de Identificación Fiscal) is the tax identifier for companies and other legal entities. It is 9 characters long: an organisation-type letter, a 7-digit body, and a final control character that may be a digit or a letter. This validator checks the type and the control so you can catch a mistyped tax ID before submitting paperwork.

How it works

  1. Organisation letter. The first character must be one of the recognised types (A, B, C, D, E, F, G, H, J, N, P, Q, R, S, U, V, W).
  2. Control calculation. Across the 7-digit body, digits in odd positions (1st, 3rd, 5th, 7th) are doubled, and if the result exceeds 9 its digits are summed (equivalently, subtract 9). Even-position digits are added unchanged. The two are summed, and the control digit is (10 − total mod 10) mod 10.
  3. Digit or letter. That control digit maps to a letter via the table JABCDEFGHI (index 0 = J, 1 = A, …). Types P, Q, R, S, N, W use the letter; A, B, E, H use the digit; all others accept either.

Example

For a CIF body of 5872073 under type A:

  • Odd positions (5, 7, 0, 3) doubled → 10, 14, 0, 6 → digit-summed → 1, 5, 0, 6 = 12
  • Even positions (8, 2, 7) → 8 + 2 + 7 = 17
  • Total = 29 → control digit = (10 − 9) mod 10 = 1

So A58720731 is valid for a type that uses the digit form.

First letterOrganisation typeControl form
ASociedad anónima (S.A.)Digit
BSociedad limitada (S.L.)Digit
PLocal authorityLetter
QPublic bodyLetter

It runs entirely in your browser, so the number you type is never uploaded. A structurally valid CIF is not guaranteed to be one that has actually been issued.

Ad placeholder (rectangle)