Spanish CIF generator (valid company tax IDs)

A valid CIF (Spanish company tax ID) has 9 characters: a letter for the organization type, 7 digits (the first two are the province) and a check character, digit or letter depending on the entity type, calculated with a weighted sum and mod 10. CIFs generated by DataMockSeed are fake and match no real company.

The CIF combines an organization type letter, the province, a number and a check character that can be a digit or a letter depending on the entity type.

5 generated examples
J41122953Valid
A46980942Valid
Q5068320JValid
H46317889Valid
F11684735Valid

How it's calculated

Organization type letter + province + number + check digit or letter depending on the type.

Generated sample
J41122953

Weighted sum of the 7 digits (province + number): odd positions are doubled.

  1. 1
    Province + number (7 digits)
    4112295
  2. 2
    Weighted sum (odd ×2 adjusted, even as is)
    27
  3. 3
    Check digit = (10 − sum mod 10) mod 10
    3
  4. 4
    Check character
    3

Frequently asked questions

Why do some CIFs end in a letter and others in a number?

It depends on the first letter, which indicates the organization type: P, Q, R, S, N and W always take a check letter; A, B, E and H (such as public and private limited companies) always take a digit; the rest accept both.

Do the generated CIFs belong to real companies?

No. The number and the check character are fictitious; only the format and the calculation follow the official algorithm.

Can I generate CIFs for a specific organization type?

Yes. In the full generator you can set the document subtype to “cif” and combine it with other company fields.

Keep exploring

Looking for more data types? Try the full generator.