Data Masking, Anonymisation and Pseudonymisation Under UK GDPR: What Each One Actually Means

Data protection · November 2026 · 9 min read

One takes data outside the law, one leaves it fully inside, and the third can produce either. The legal definitions, why a masked database is usually still personal data, which technique fits which environment, and when to generate instead.

Data masking, anonymisation and pseudonymisation are used as if they meant the same thing, and under UK GDPR they do not. One of them takes data outside the law entirely; one leaves it fully inside; and the third is a family of techniques that can produce either result depending on how it is done. For a team deciding what to put in a test environment, a data warehouse or a report, the distinction is the difference between a compliance task and no compliance task at all.

The three terms

Anonymisation is the process of turning personal data into data from which no individual can be identified, by anyone, by any means reasonably likely to be used. Truly anonymous data is not personal data, and UK GDPR does not apply to it. That is a high bar, and the ICO's guidance is clear that it depends on context: the same data set can be anonymous in one setting and identifiable in another, depending on what other data is available to whoever holds it.

Pseudonymisation is defined in UK GDPR itself (Article 4(5)): processing personal data so that it can no longer be attributed to a specific individual without the use of additional information, where that additional information is kept separately and protected. Replacing names with customer IDs is the classic example. Pseudonymised data is still personal data. The law treats pseudonymisation as a good security measure, and it reduces risk, but it does not remove any obligation.

Data masking is an engineering term, not a legal one. It covers any technique that replaces sensitive values with substitutes: scrambling, shuffling, substitution from a dictionary, nulling, date shifting, format-preserving encryption, partial redaction (****1234). Depending on which techniques are applied to which fields, and whether the result can be reversed or re-linked, masking produces anonymised data, pseudonymised data, or data that is barely changed. The word says nothing on its own about which.

Why a "masked" database is usually still personal data

Teams often mask the obvious columns (name, email, phone) and conclude the copy is safe to hand to developers and contractors. Three things defeat that conclusion:

Quasi-identifiers. Date of birth, postcode and sex together identify a large majority of UK residents uniquely. If masking replaces the name and leaves those three, the data is pseudonymised at best. The same applies to a full address with the name removed: it still points at one household.

Free text. Support tickets, order notes, delivery instructions and comment fields hold names, phone numbers and addresses that no column-level rule touches. So do logs, JSON blobs and attachments.

Linkability. If the masked data keeps the real customer ID, or masks it deterministically (the same input always gives the same output), anyone with access to another system holding the same IDs can re-link it. Deterministic masking is often necessary so that joins still work, and it is precisely what keeps the data pseudonymous rather than anonymous.

Under UK GDPR, pseudonymised data in a test environment is personal data being processed for a new purpose, with everything that implies: a lawful basis, security appropriate to the risk, access limited to those who need it, and inclusion in the breach-notification process if it leaks. Using real customer data in test environments walks through those obligations.

When masking is the right tool

Masking earns its place when you need production's shape and scale:

  • Performance and load testing, where the volume and distribution of real data matter and synthetic generation at that scale is expensive.
  • Analytics and reporting environments that need real aggregate behaviour but not real identities.
  • Reproducing a production incident that depends on a particular data pattern.

In each case the honest framing is: this is pseudonymised personal data, treated as such, held in an environment with production-grade controls, for a specific purpose and a limited time. The masking reduces the harm if it leaks; it does not make the copy free of obligations.

When synthetic data is the right tool

For development, automated tests, demos, training and anything that will be shared beyond a tightly controlled group, synthetic data is the cleaner answer. It is generated from rules or models and never derived from a real record, so there is no individual to identify and nothing to re-link. It can be shared in a bug report, pasted into a slide, committed to a public repository or handed to an offshore team without a data protection question arising.

The engineering cost is realism. Synthetic data that breaks format rules gives false confidence: validators that pass in test fail in production, and edge cases never appear. Good synthetic data is structurally valid (postcodes that follow the real grammar, check digits that check out), realistically distributed (flats, house names, long surnames, Northern Irish postcodes at roughly their real frequency), and safely fictional (phone numbers from Ofcom's drama ranges, NHS numbers from the reserved test range, addresses that are not live delivery points). Test data management: production copies, masked data and synthetic data compares the approaches in detail, and how UK address generators work shows what "structurally valid but fictional" means for addresses specifically.

Techniques, and what each one achieves

Real anonymisation almost always combines generalisation, suppression of outliers and aggregation, and is assessed against the risk of re-identification rather than declared by fiat. The ICO's anonymisation guidance frames this as a "motivated intruder" test: could someone with ordinary means and some motivation identify an individual? If so, the data is not anonymous.

A practical decision path

1. Does this environment need real individuals' records? Only for incident reproduction. Treat the copy as production data, limit it, and delete it afterwards. 2. Does it need production's scale and distributions? Mask, and call the result pseudonymised. Apply production-grade controls. Document the purpose and lawful basis. 3. Does it need correct formats, edge cases and referential integrity? Generate. This covers most development and testing. 4. Will the data leave the controlled group? Generate, without exception.

For UK-specific identifiers, generation is well served. The test data generator produces complete fictional personas with addresses on real postcode districts, and the identifier tools cover the fields that carry check digits or reserved test ranges: the NHS number validator and generator, the National Insurance number validator, the VAT number validator, the company number checker and the bank details checker. The REST API returns the same data for seed scripts and CI.

The one-line version

Anonymised data is not personal data; pseudonymised data is; "masked" data is whichever one you actually produced, and you should know which. For everything except reproducing production and testing at production scale, generating data from scratch is simpler than proving a masked copy is safe.

More guides