---
id: "nif"
kind: "datatype"
status: "stable"
is_pii: true
categories: ["finances"]
country: ["ES"]
langs: ["es"]
quality: 95
url: "http://registry.apicrafter.io/datatype/nif"
---

# NIF por nombre de campo (`nif`)

ES datatype for 'NIF por nombre de campo' (nif) from rules in context 'finances'. The Spanish tax identification number (Número de Identificación Fiscal, NIF) is a unique identifier assigned to individuals and entities for tax purposes in Spain. For individuals, it consists of 8 digits followed by a check letter. For foreigners, it may start with X, Y, Z, K, L, or M followed by 7 digits and a check letter. The total length is 9 characters.

- Personal data (PII): yes
- Categories: Finances and banking (finances)
- Countries: Spain (ES)
- Languages: Spanish (es)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^([0-9]{8}|[XYZKLM][0-9]{7})[TRWAGMYFPDXBNJZSQVHLCKE]$
```

## Examples

- `12345678Z` — Spanish NIF for a Spanish citizen with 8 digits and check letter
- `X1234567L` — Spanish NIF for a foreigner starting with X followed by 7 digits and check letter
- `87654321X` — Another valid Spanish NIF format

## Mappings

- google_dlp: `SPAIN_NIF_NUMBER`
- presidio: `ES_NIF`
- schema_org: `taxID`
- stdnum: `es.nif`

## Metacrafter rules

2 rules: 1 match the field name, 1 match values.

- `es_tax_esniffield` (field, `es/es_tax.yaml`)
- `es_tax_esnifvalue` (data, `es/es_tax.yaml`)

## Supported by tools

- `amazonmacie`
- `awsglue`
- `azureailanguage`
- `googledlp`
- `ibmknowledgecatalog`
- `metacrafter`
- `openmetadata`
- `presidio`
- `pythonstdnum`

## Translations

- en: Spanish Tax Identification Number (NIF)
- es: Número de Identificación Fiscal (NIF)

## Sources

- wikipedia: <https://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal>
- doc: <https://www.agenciatributaria.es/AEAT.internet/Inicio/Ayuda/Modelos__Procedimientos_y_Servicios/Comun/Preguntas_frecuentes/Identificacion_y_Domicilio_Fiscal/Preguntas_frecuentes_sobre_NIF_NIE_CIF.shtml>

## Quality

Score 95/100. Missing: negative example.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/nif.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/ES/finances/nif.yaml>
