Use this when sensitive values must be hidden but data stays usable.
Masking
Data masking hides sensitive values by replacing parts of them, such as showing ****1234 for a card number, or using realistic fake values in test databases, so data stays usable without exposing originals.
1. Masking hides parts of data (e.g. ****1234).
2. Static masking for test data; dynamic for display.
3. Not reversible (unlike encryption/tokenisation).
4. Use for non-production.
5. Verify masks are applied.
real data → masking → masked output
Context & applicabilityCommon mistakes · platform/version boundaries
- Dynamic masking treated as access control — users can often infer values through queries (
WHERE Email LIKE 'a%'). - Masked test data that can be linked back to people with other columns.
- Admins with
UNMASKrights by default. - Masking only in the UI while APIs return full data.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Static masking for test copies, dynamic for display.
- Masked data should not be reversible.
- Keep format where needed.
- Masking rules (display, test data) — applied
- Test/dev environments use masked data — no production PII
- Dynamic data masking settings in DB — queries
ReferenceWhy it matters1 section · depth on demand
Static vs dynamic masking
- Static masking creates a masked copy (test and development data), irreversibly.
- Dynamic masking hides values at query time based on the user's role; the stored data is unchanged.
Masked test data must not allow re-identification by combining fields (name + birth date + postcode).
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Data masking hides sensitive values while keeping data usable — for example showing only the last four digits of an account number, or replacing real customer names with realistic fake ones in test environments.
| Type | Use |
|---|---|
| Static masking | Copy production data to test with values permanently replaced |
| Dynamic masking | Mask at query time based on user role |
| Tokenisation | Replace with a token; real value retrievable only from a secure vault |
| Redaction | Remove values entirely (logs, documents) |
| Pseudonymisation | Replace identifiers; re-identification possible with separate key |
Using real production data in development and test environments is a common source of breaches; masked or synthetic data removes that risk. Note that pseudonymised data is still personal data under GDPR.
Examples
| Data | Masked |
|---|---|
| Card number | ** ** 1234 |
p****@example.com | |
| CPR number | 010190-**** |
| Phone | +45 12 34 |
SQL Server dynamic data masking: ALTER TABLE Customers ALTER COLUMN Email ADD MASKED WITH (FUNCTION = 'email()'). Users with UNMASK permission see real values.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Data Security → Masking. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/sp/800/209/final · confidence 94%