# Brazil's CPF vs European National ID Numbers (DNI, NIF, Codice Fiscale)

> How Brazil's CPF compares to Spain's DNI, Portugal's NIF and Italy's codice fiscale, what is different and how to verify a Brazilian ID number by API.

**Published:** November 20, 2026
**Author:** Lucas Vieira
**URL:** https://www.cpfhub.io/en/blog/cpf-vs-european-national-id-numbers

---


## Introduction

The closest thing Brazil has to a national ID number is the **CPF** (Brazil's individual taxpayer registry number). Like Portugal's NIF or Italy's codice fiscale, it started as a tax number. Like Spain's DNI number, it now works as the reference number for a person's identity across banks, employers, shops and government services.

That makes the comparison useful, but not exact. The CPF is a number, not a card. It encodes no personal data, and because Brazilians share it every day, knowing a CPF proves nothing about who you are talking to. This guide compares the CPF with three European numbers that teams in Spain, Portugal and Italy already know, then shows what changes when you verify a Brazilian.

---

## The CPF in one paragraph

The CPF is issued by the [Receita Federal](https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/cpf) (Brazil's Federal Revenue Service). It has 11 digits, two of them check digits, and each person keeps the same number for life. Children can be registered at birth, and foreigners can [apply for one](https://www.gov.br/pt-br/servicos/inscrever-no-cpf) too. The CPF is printed on the driver's license (CNH), and Brazil's new national identity card uses it as the card number. In practice, it is the key that ties a person to bank accounts, Pix transfers, invoices, employment and health records.

---

## Spain: the DNI and the NIF

In Spain, the [DNI](https://www.dnielectronico.es/PortalDNIe/PRF1_Cons02.action?pag=REF_1010) (Documento Nacional de Identidad) is a physical identity card issued by the National Police, with a photo and a chip. For Spanish nationals, the DNI number followed by a check letter also works as the NIF, the tax identification number. Spaniards without a DNI get a NIF through a separate procedure at the [Agencia Tributaria](https://sede.agenciatributaria.gob.es/Sede/ayuda/consultas-informaticas/presentacion-declaraciones-ayuda-tecnica/modelo-030/soliictud-nif-persona-fisica-sin-presencial.html).

**What is similar:** one number per person serves both identity and tax purposes, and it is asked for everywhere.

**What is different:** the DNI is a document you can inspect, with a photo and a chip that can sign electronically. The CPF on its own is only a number. To link a Brazilian to a face, you need a separate document check.

---

## Portugal: the NIF

Portugal's NIF (Número de Identificação Fiscal) is a nine-digit tax number issued by the Autoridade Tributária. Portuguese citizens with a Cartão de Cidadão already have one assigned, and foreigners can [request a NIF](https://www.gov.pt/servicos/pedir-o-numero-de-identificacao-fiscal-para-pessoa-singular) separately.

**What is similar:** both are tax numbers issued by the tax authority, one per person, used far beyond taxes, and both are available to foreigners.

**What is different:** in Portugal the identity card and the tax number are separate numbers printed on the same card. In Brazil, the CPF is becoming the identity card number itself, so one identifier carries both roles.

---

## Italy: the codice fiscale

Italy's [codice fiscale](https://www.agenziaentrate.gov.it/portale/web/english/nse/individuals/tax-identification-number-for-foreign-citizens) is a 16-character alphanumeric code issued by the Agenzia delle Entrate and determined from personal data: surname, first name, date and place of birth and sex.

**What is similar:** it identifies a person in dealings with public administrations and private companies, much like the CPF.

**What is different:** the codice fiscale is derived from personal data, so part of it can be predicted from a person's details. The CPF is an assigned number with check digits: it reveals nothing about the holder except, through its ninth digit, the fiscal region where it was first registered. You cannot calculate someone's CPF from their name or birth date.

---

## Side by side

| | Brazil CPF | Spain DNI / NIF | Portugal NIF | Italy codice fiscale |
|---|---|---|---|---|
| Issued by | Receita Federal | National Police (DNI) / Agencia Tributaria | Autoridade Tributária | Agenzia delle Entrate |
| Format | 11 digits | Number plus check letter | 9 digits | 16 alphanumeric characters |
| Encodes personal data | No | No | No | Yes |
| Is a physical card | No (printed on other documents) | Yes (DNI) | No (printed on the citizen card) | No (printed on the health card) |
| Used beyond taxes | Everywhere | Everywhere | Widely | Widely |

The European Commission's [TIN on Europa](https://ec.europa.eu/taxation_customs/tin/) tool checks the structure of tax numbers from EU member states. There is no equivalent for the CPF in that system, since Brazil is outside the EU.

---

## What changes when you verify a Brazilian

European teams used to checking a DNI card or validating a codice fiscale against a name tend to assume a format check is enough. With the CPF it is not, for two reasons:

1. **The format proves nothing about the person.** Valid CPFs can be generated with the public check digit algorithm, and real ones are easy to collect from invoices and receipts.
2. **There is no card to inspect.** The number has to be matched against registry data, and for higher-risk flows, against a document and a selfie.

A typical flow with [**CPFHub.io**](/en):

- **Simple Lookup:** `GET /cpf/{cpf}` returns the holder's name, gender and date of birth. Compare them with your form. A CPF that is not found returns 404 and does not use a credit.
- **Real-Time Lookup:** with the CPF and date of birth, returns the registration status at the Receita Federal, the year of death when there is one and the proof. See the [Real-Time Lookup page](/en/cpf-lookup-federal-revenue).
- **Identity Verification:** liveness, face match and document reading for RG, CNH and passport, when you need to know the user is the holder. See [Identity Verification](/en/identity-verification).

```bash
curl --max-time 10 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  https://api.cpfhub.io/cpf/00000000000
```

Call the API from your backend, with the key in an environment variable. Under the LGPD (Brazil's data protection law), the CPF is personal data, so collect it for a stated purpose, much as you would under the GDPR.

---

## Frequently asked questions

### Is the CPF the same as a national ID card?

No. The CPF is a number. Brazil's new national identity card uses the CPF as its number, but older documents like the RG have their own numbers, and the CPF itself is not a card.

### Can a European resident get a CPF?

Yes. Foreigners, including people living abroad, can register for a CPF with the Receita Federal, for example to open an account or buy property in Brazil.

### Can I validate a CPF against the holder's name, like a codice fiscale?

Not by calculation. The CPF does not encode the name or birth date, so you need a registry lookup to see whose CPF it is and compare.

### Does a CPF work like a NIF for invoices?

Yes, in the sense that Brazilian consumers can ask for their CPF on invoices and companies use it to identify individuals for tax purposes. For companies, Brazil uses the CNPJ instead. See [CPF vs CNPJ](/en/blog/cpf-vs-cnpj).

---

### Read also

- [What Is a Brazilian CPF? A Guide for Foreign Companies](/en/blog/what-is-a-brazilian-cpf)
- [Brazil's CPF vs the UK National Insurance Number](/en/blog/cpf-vs-uk-national-insurance-number)
- [CPF Check Digits vs a Real Registry Lookup](/en/blog/cpf-check-digit-vs-registry-lookup)
- [LGPD for Foreign Companies Processing Brazilian Personal Data](/en/blog/lgpd-for-foreign-companies)

## Conclusion

The CPF sits somewhere between Spain's DNI number, Portugal's NIF and Italy's codice fiscale: a lifelong tax number that became the reference for identity. Unlike those, it is not a card and does not encode personal data, so verifying a Brazilian means matching the number against registry data and, when the risk calls for it, a document and a selfie.

Try a lookup with 50 free credits and no credit card at [cpfhub.io](/en).

