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.

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.

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?
What is data masking in cyber security?
What is the difference between data masking and anonymization?
What is data masking in a database?
What is data masking in AI?
What is data masking in ISO 27001?
Which tools mask sensitive data?
References
- Masking as a named security safeguard in India: MeitY, Digital Personal Data Protection Rules, 2025 (G.S.R. 846(E), 13 November 2025)
- How dynamic data masking works and its limits: Microsoft Learn, Dynamic Data Masking
- Finding and masking sensitive data in data pipelines: AWS Glue Developer Guide, Detect and Process Sensitive Data
Get the Latest Terms & Insights.
New encyclopedia terms, threat intelligence, and architecture decisions, by email.
