Data masking is the hiding of part or all of a sensitive value, so that a person or a program sees only what it needs. A card number shown as XXXX XXXX XXXX 4821, with only the last four digits visible, is the best-known example. Masking is used in three main places: on screens, in copies of data made for testing, and, more and more, in data sent to AI models.
On screens, masking is applied as the data is shown, and the stored value does not change. A support agent sees the masked value, while a manager with more rights may see the full value. This is called dynamic masking. In test copies, the real values are replaced permanently before developers receive the copy. A real name becomes a made-up name, and a real phone number becomes a made-up number in the same format. This is called static masking. Developers need realistic data to test their code, but they do not need real customers.
The newest place is AI. Consider a broadband provider in Visakhapatnam that wants an AI model to summarise its customer-support chats, about 50,000 a month. The chats contain customers' names, phone numbers and email addresses, and sometimes card numbers that customers typed in. The masking software reads each chat before it is sent to the model. In one chat, it finds 6 sensitive values, and replaces each one with a placeholder, such as [NAME_1] or [PHONE_1]. The model writes its summary using the placeholders. The software keeps the list of placeholders for that chat. So, on the way back, it can put the customer's name into the summary for the support team, who are allowed to see it. The phone and card numbers stay masked. The AI model never receives any of the real values.
This matters because data sent to an outside AI model leaves the company's control, and a model may repeat what it was given. The same masking is applied to documents before they are stored for retrieval-augmented generation (RAG), the method by which a model looks up a company's documents to answer questions.
Masking differs from data tokenisation. An approved system can swap a token back for the real value. A value masked on a screen or in a test copy usually cannot be recovered, because the hidden digits are gone. So masking suits data that people need to recognise, not data that a system must use later. Masking works next to LLM guardrails, which check a model's inputs and outputs for attacks. To find the values to mask in databases, the tool can use the labels from data security posture management (DSPM).