# Pseudonymization

> Swapping names and emails for a code. The same person always gets the same code.

**Field:** Data Engineering  
**Category:** Data Privacy  
**Also known as:** Pseudonymisation, Data Tokenization, Pseudonymous Data

## Think of it like

Each child in class gets a secret number. The teacher keeps the list of who is who.

## Definition

Pseudonymization swaps the fields that name a person for a code, called a token or pseudonym. The same person always gets the same code, so you can still join and count them. The key that links codes back to names is kept apart, under tight control. With the key, the data can be traced back to the person. So in law it still counts as personal data.

## Example

Analysts study what people buy by their code. They never see an email, but they can see that code 7f3a9c bought three times.

## Example code

```sql
SELECT SHA2(email || 'secret-salt', 256) AS customer_token,
       country, order_total
FROM orders;
```

Each email becomes the same long code every time. Without the salt, nobody can turn it back.

## Why it matters

The data stays useful for study. If it leaks, far less harm is done.

## Common mistake

Calling it anonymous. With the key, or enough other fields, a person can be found again.

## Three principles

- **Code for a name.** A token replaces direct identifiers.
- **Stays joinable.** Same person, same code.
- **Key kept apart.** So it is still personal data.

## Related terms

- [Data Anonymization](https://learn.benibix.com/term/data/data-anonymization)
- [Data Masking](https://learn.benibix.com/term/data/data-masking)
- [Personally Identifiable Information (PII)](https://learn.benibix.com/term/data/personally-identifiable-information)
- [Hashing (Cryptography)](https://learn.benibix.com/term/development/hashing)
- [Hashed Email](https://learn.benibix.com/term/marketing/hashed-email)

## Told apart from

- [Pseudonymization vs Data Anonymization](https://learn.benibix.com/compare/pseudonymization-vs-data-anonymization): People think pseudonymized data is anonymous. It is not. Names are swapped for a code, and a key that is kept can turn the code back into a person. Anonymized data has no key and no way back. In law, the first is still personal data. The second is not.

![One customer row shown four ways. Original: Emma Brown, emma@example.com, born 1990-04-12. Masked: E**** B****, e***@example.com. Pseudonymized: customer token 7f3a9c, same token every time. Anonymized: an age band of 30 to 39 in a count of 412 people, with no way back to Emma.](https://learn.benibix.com/diagrams/data-masking.svg)

---

Source: https://learn.benibix.com/term/data/pseudonymization
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
