What is Data Masking?
Types, Techniques and Examples

Data masking is a way to hide sensitive data, such as names, phone numbers or card numbers, by swapping it with realistic fake values or partly hidden ones. Testers, support staff and partners can then use the data for their work without ever seeing the real customer details behind it.

Short Answer Data masking is a way to hide sensitive values, such as names, PAN or card numbers, by showing realistic fake or partly hidden values instead. People and test systems can then work with the data without seeing the real thing. For example, your bank SMS shows your account number as XX4821.

What is Data Masking?

Most companies hold sensitive data, meaning information that can harm a person or the business if the wrong people see it. Examples include customer names, mobile numbers, addresses, Aadhaar or PAN numbers, salaries and bank account details.

Data masking changes how this information looks, so the real value stays hidden. However, the masked data still looks and behaves like real data. A masked phone number still has ten digits, and a masked date is still a date. As a result, software keeps working, testers can test, and support staff can do their jobs.

Think of it like a notice board in an office lobby. The board shows “Ravi K., Accounts” instead of Ravi’s full name, mobile number and home address. Visitors see only what they need. Data masking applies the same idea to databases, reports and screens.

Key Words to Know

  • Personal data (PII): any detail that points to a real person, such as a name, phone number or email. PII stands for personally identifiable information.
  • Production data: the live data your business runs on every day.
  • Test data: data that developers and testers use to check new software before it goes live.
  • Redaction: blacking out or removing a value completely, like ink over words on a paper form.
  • Anonymization: changing data so that no one can ever link it back to a person, even with extra information.

Why is Data Masking Used?

Companies use data masking so that people see only what their work needs. In fact, many staff, vendors and systems touch customer data, but very few need the full, real values. Here are the most common reasons:

  • Safe testing: developers often need a copy of the database to test new features. A masked copy lets them test without exposing real customer details.
  • Training: new staff can practice on realistic records instead of real ones.
  • Sharing with vendors: an outside IT partner can get masked data. Then a leak at their end does not expose your customers.
  • Need-to-know access: a support agent may see only the last four digits of a card number, which is enough to confirm a caller.
  • Legal duty: India’s Digital Personal Data Protection Act, 2023 (DPDP Act) requires businesses to protect personal data with reasonable security safeguards.

The DPDP Rules, 2025, notified on 13 November 2025, go one step further. Their rule on security safeguards names masking, encryption, obfuscation (making data hard to read) and virtual tokens as examples of data security measures. So masking is one listed option among several. That rule comes into force 18 months after publication, in May 2027. For the wider topic of how to treat personal information fairly, see our guide on data privacy.

Masking also limits the harm from mistakes. A leaked masked copy holds only fake names and hidden numbers.

What Are the Types of Data Masking?

There are three main types of data masking. They differ in when the change happens and whether the stored data changes.

  • Static masking: you make a copy of the database and mask the copy. The changes are permanent in that copy. Teams then use the copy for testing or training, while the original stays untouched.
  • Dynamic masking: the stored data stays real, but the system hides parts of it at the moment someone views it. So two people can run the same search and see different results, based on their access rights.
  • On-the-fly masking: the system masks data while it moves from one system to another, for example from the live database to a test server. The real values never land on the test server. So no unmasked copy sits outside the live system.
Question Static Dynamic On-the-Fly
When does masking happen? Once, on a copy Every time someone views data While data moves
Does stored data change? Yes, in the copy No Yes, at the destination
Common use Test and training databases Support and staff screens Feeding test or analytics systems

Data Masking Techniques

A technique is the exact method used to change a value. Teams usually mix several data masking techniques in one database, because each column needs a different treatment.

  • Substitution: swap the real value for a realistic fake one. For example, “Priya Sharma” becomes “Anita Verma”.
  • Shuffling: mix up values within the same column. Every city name stays real, but it now sits next to the wrong customer.
  • Partial hiding: show only part of the value. A mobile number 98XXXXXX21 still helps a support agent confirm a caller.
  • Nulling: remove the value and leave the field blank. This suits fields that testers never need, such as passport numbers.
  • Date shifting: move dates by a few days or months. A birth date of 12 March 1985 might become 20 April 1985, so ages stay roughly right.
  • Number variance: change numbers by a small random amount. A salary of 85,000 might show as 82,400, so reports still look sensible.
Real record becomes masked record, field by field
Each field gets its own technique, so the record still looks real but no longer reveals the customer.

A Bank Call Center Example

A private bank in Mumbai wants to test a new version of its call center software. The testers need thousands of customer records, so the IT team copies the customer database. Next, they run data masking on the copy. The masking tool swaps names for fake names, and account numbers keep only their last four digits. Then it partly hides mobile numbers and shifts birth dates by a few weeks. Finally, the testers receive the masked copy. The software works exactly as it would with real data, yet no tester ever sees a real customer.

Data Masking vs Encryption vs Tokenization

People often mix up these three ideas, because all of them protect sensitive data. The key difference is whether someone can get the original value back.

  • Encryption scrambles data with a secret key. Anyone with the right key can unlock it and read the original. Our guide on data encryption explains it in more detail.
  • Tokenization replaces a value with a random stand-in code called a token. A separate, locked system, often called a vault, keeps the link between the token and the real value.
  • Data masking usually changes the value for good, at least in the masked copy. In most cases, no key or vault can bring the original back.
Question Masking Encryption Tokenization
Can you get the original back? Usually no (dynamic masking hides, but keeps the original stored) Yes, with the key Yes, through the token vault
Does it look like real data? Yes No, it looks like random text Often yes, same length or format
Who uses it? Testers, trainers, support staff, analysts Systems that store or send data Payment and billing systems

In practice, companies use all three together. For instance, a bank encrypts its live database, tokenizes card numbers for payments and masks the copies it gives to testers.

Talk to an ExpertDo your test systems still hold real customer data? Talk to our team about data masking.

Data Masking Examples

Here are three common data masking examples, all from the same Mumbai bank call center.

Customer Support Screens

A support agent at the bank opens a customer record during a call. The screen shows the account number as XXXXXX4821 and the email as aXXX@XXXX.com. The agent asks the caller to confirm the last four digits, and the call moves on. A manager with higher rights sees the full values. This is dynamic masking, and it ties directly to access control, the rules that decide who can see what.

Test Database Copies

Every month, the bank refreshes its test database from the live one. The copy passes through a masking step before it reaches the test server. This is on-the-fly masking. So developers, outside testers and contractors work only with fake but realistic records.

A live database copy passing through a masking step to a safe test server
Masking the copy before it reaches the test server means testers and vendors never handle real customer data.

Reports and Analytics

The marketing team wants to study which cities call the most. They do not need names or phone numbers for that. Therefore, the data team sends a report with names removed, numbers hidden and only city and call counts left in full. As a result, personal details stay out of emailed spreadsheets.

Masking also lowers the risk from an insider threat, meaning a staff member who misuses access. Someone who never sees real values cannot copy or sell them.

Data Masking on Microsoft and AWS

Microsoft and AWS both offer built-in features to find sensitive data and to mask it. You need both steps, because you cannot mask what you have not found.

Azure SQL and SQL Server

Microsoft offers dynamic data masking in Azure SQL Database, Azure SQL Managed Instance and Azure Synapse Analytics. SQL Server has it from the 2016 version onward. It hides sensitive columns (fields such as phone or email) in search results for users without special rights, while the stored data stays the same. It includes ready-made masks, such as one for email addresses and one that shows only the last four digits of a card number. Administrators can grant an “UNMASK” right to the few people who need full values. In the Azure portal, it can also suggest columns that look sensitive.

However, Microsoft says this feature should not be the only protection. A user who can run their own database searches can sometimes guess hidden values. So Microsoft advises auditing (keeping a record of who did what), tight permissions and extra protections such as encryption.

Amazon Macie and AWS Glue

Amazon Macie is an AWS service that finds sensitive data stored in Amazon S3, the AWS object storage service. It scans stored files automatically to spot personal data, financial details and secret sign-in keys, then reports where it found them. Macie does not mask data itself, but it shows you what needs masking.

AWS Glue, the AWS service for moving and preparing data, includes a Detect PII transform. A transform is a step that changes data as it passes through. It can find sensitive values and redact them or hide part of them. It can also replace them with a hash, a fixed code made from the value. You can also add your own patterns, for example to catch PAN numbers. This suits on-the-fly masking when you copy data into a test or analytics system.

These features work best inside wider data governance, which sets the rules for who owns each kind of data and how to handle it.

What Masking Cannot Do

Masking is only one layer of protection. It does not stop an attacker who breaks into the live database, because the real values still sit there. For that, you need encryption, strong sign-in and monitoring as part of overall data security.

Weak masking can also fail. If you swap names but leave the full address and birth date, someone may still work out who the record belongs to. So check masked data before you share it, and mask every field that could point to a person. A good first step: list every test server and vendor folder that holds customer data. Done well, masking means that a leaked test copy does not become a data breach of real customer records.

Frequently Asked Questions About Data Masking

What is data masking in SQL Server?

In SQL Server, data masking usually means dynamic data masking, a feature available in SQL Server 2016 and later. You set a mask on a column, such as email or phone number. Users without the UNMASK right then see hidden values in their results, while the stored data stays real. Administrators can still see everything, so permissions and auditing still matter.

What is data masking in cyber security?

In cyber security, data masking is a way to shrink the amount of real sensitive data that people and systems can reach. Fewer copies of real data means fewer places for attackers to steal from. It also limits what a careless or dishonest staff member can see. It works alongside encryption, strong sign-in and monitoring, and never replaces them.

What is the difference between data masking and anonymization?

Data masking hides or changes sensitive values, but some masked data can still point to a person, for example when an address stays in full. Anonymization goes further. It changes data so that no one can link it back to a person, even with extra information. So masking lowers risk, while true anonymization aims to remove the link to a person for good.

What is data masking in a database?

In a database, data masking hides sensitive columns, such as names, phone numbers or account numbers. There are two common ways. You can mask a copy of the database for testing, so the copy holds only fake values. Or you can mask values on screen as people view them, so the stored data stays real but most users never see it.

What is data masking in AI?

In AI, data masking means hiding personal details before data goes into a model or an AI tool. For example, a company may remove names and phone numbers from support chats before using them to train a chatbot. This helps keep personal data out of the model and its answers. Our guide on AI data management covers preparing data for AI more widely.

What is data masking in ISO 27001?

ISO/IEC 27001 is the global standard for an information security management system. Its 2022 edition lists control 8.11, Data masking, in Annex A, and ISO/IEC 27002:2022 explains how to apply it. The control asks companies to mask sensitive data, especially personal data, in line with their access rules, business needs and the law. In practice, auditors look for a clear, written masking approach.

Which tools mask sensitive data?

Many databases and cloud platforms include masking features. On Microsoft, Azure SQL Database and SQL Server offer dynamic data masking. On AWS, Amazon Macie finds sensitive data in Amazon S3, and AWS Glue can detect and redact personal data while copying it. The right choice depends on where your data lives and whether you need masked copies or masked screens.
Use CaseProtect Sensitive and Confidential Business Data

References

  1. Masking as a named security safeguard in India: MeitY, Digital Personal Data Protection Rules, 2025 (G.S.R. 846(E), 13 November 2025)
  2. How dynamic data masking works and its limits: Microsoft Learn, Dynamic Data Masking
  3. Finding and masking sensitive data in data pipelines: AWS Glue Developer Guide, Detect and Process Sensitive Data
Stay Updated

Get the Latest Terms & Insights.

New encyclopedia terms, threat intelligence, and architecture decisions, by email.

Book a Consultation

A practice principal will contact you within 1 business day.

Thank you! A Signisys principal will be in touch within 1 business day.