Book a free call

Tokenization for Sensitive Data: How It Protects Records

Tokenization protects sensitive data by replacing card numbers and personal details with random tokens, so a breach exposes nothing useful. Here is how it works.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Tokenization for Sensitive Data: How It Protects Records
On this page

Short answer

Tokenization is a way to protect sensitive data by replacing a real value, such as a card number or a national ID, with a random token that has no meaning on its own. The real value is stored safely in a separate vault, and systems use the token instead. If the token is stolen, it is useless without access to the vault.

What is tokenization for sensitive data?

Tokenization for sensitive data is the process of swapping a sensitive value for a random token, then storing the link between the two in a secure vault. Applications, logs and databases handle only the token, so the sensitive value appears in as few places as possible.

Unlike encryption, a token is not a scrambled version of the original. It is a random string with no mathematical link to the real value, so it cannot be reversed by working out a key. The only way back is through the vault, which is guarded separately.

MethodWhat it doesCan it be reversed?Best for
TokenizationReplaces the value with a random tokenOnly through the vaultCard numbers, IDs, account numbers
EncryptionScrambles the value with a keyYes, with the keyData in transit and at rest
MaskingHides part of the valueNo, the hidden part is goneDisplaying data on screen
HashingTurns the value into a fixed fingerprintNo, one way onlyPasswords, checking a value

Tokenization is not the same as asset tokenization on a blockchain, where a token represents ownership of a real asset. Here the token is a stand-in for a piece of data, and its job is to keep that data out of the systems that do not need it.

How does tokenization work in practice?

Tokenization works in four steps: a sensitive value enters the system, a token is created and stored in a vault, the token replaces the value everywhere else, and the real value is fetched from the vault only when it is truly needed.

When a customer pays, for example, the card number goes straight to the tokenization service, which returns a token. The shop's systems store the token, print it on receipts and use it for refunds. The card number itself lives only in the vault.

The vault is the most protected part of the system. It sits behind strict access rules, logging and separation from the rest of the application, so that even if the main database is breached, the attacker finds tokens, not card numbers.

Some tokens keep the same shape as the original, such as a 16-digit token for a 16-digit card number. That is called format-preserving tokenization, and it lets old systems keep working without changes. Data security and compliance teams often choose it when a full rebuild is not possible.

Where is tokenization used?

Tokenization is used wherever sensitive data passes through systems that do not need the real value: payments, healthcare records, banking, and customer databases are the main cases.

In payments, tokenization keeps card numbers out of shops, apps and call centres. A shop can charge a returning customer using the token, without ever storing the card number itself. This also reduces the scope of payment security rules, since fewer systems touch real card data.

In healthcare, tokenization replaces patient identifiers in research and analytics systems. Researchers can link records for the same patient using tokens, without seeing names or national ID numbers.

In banking and insurance, tokenization protects account numbers and policyholder details in logs, test data and analytics. Test environments are a common leak: a copy of production data used for testing can expose real customer details, and tokens remove that risk.

How do you choose a tokenization approach?

You choose a tokenization approach by deciding which values need protection, which systems must keep working unchanged, and who is allowed to turn a token back into the real value.

  1. List the sensitive fields. Card numbers, national IDs, account numbers and health identifiers usually come first.
  2. Find where each value travels. Map the systems, logs and reports that see the value today, so you know where tokens must replace it.
  3. Decide on token format. Format-preserving tokens keep old systems working; random tokens are simpler but may need changes.
  4. Choose who runs the vault. You can run it yourself, use a payment provider, or use a dedicated tokenization service.
  5. Set the access rules. Decide which roles can detokenize, log every request, and test what happens when the vault is unavailable.

One decision matters most: who can turn tokens back. If too many people can detokenize, the protection is weak. If too few can, the business cannot process refunds or answer customer questions. Cybersecurity services can help design the vault access model before the first token is issued.

Example: a retailer protecting card numbers

Example (hypothetical): an online retailer takes 50,000 card payments a month and stores card numbers in its order database, its logs and its customer service tool. A breach of any of those systems would expose the numbers.

After tokenization, the card number goes only to the tokenization service, and every other system stores a token. The order database, the logs and the support tool all hold tokens, so a breach of any one of them exposes nothing a thief can spend.

The arithmetic shows the change. Before tokenization, the card number lived in 5 systems. After tokenization, it lives in 1 system: the vault. That is an 80% reduction in the places where a breach could expose card data, and the payment security audit covers 1 system instead of 5.

Refunds still work. When a customer asks for a refund, the support team uses the token to find the order, and the payment service turns the token back into the card number only for that one transaction.

What are the common mistakes?

The most common mistakes are tokenizing only one system, leaving the real value in logs, and forgetting that the vault itself needs strong protection.

  • Tokenizing one system only. If the card number still sits in logs or a backup, the protection is incomplete.
  • Leaving values in logs. Applications often log full requests. Strip sensitive fields from logs before they are written.
  • Weak vault access. The vault holds all the real values, so it needs the strongest access rules and logging in the whole system.
  • No plan for vault downtime. If the vault is down, new payments cannot be tokenized. Plan a fallback and test it.
  • Confusing tokenization with encryption. Encryption can be reversed with a key, so it needs key management. Tokens need vault management, which is a different job.

How do you start a tokenization project?

You start a tokenization project by picking one sensitive field in one flow, such as card numbers in checkout, and proving the token flow works before expanding to other fields and systems.

  1. Pick one field and one flow. Card numbers in checkout are the usual first choice, because the return is clear.
  2. Map the data flow. Trace the value from entry to storage, and list every system, log and report that sees it.
  3. Choose the vault. Decide whether to run it in-house or use a provider, and check the provider's security and audit record.
  4. Replace the value in the other systems. Swap the real value for tokens in the database, logs and support tools, one system at a time.
  5. Test the fallback. Check refunds, chargebacks and support lookups still work, and test what happens when the vault is down.

After the first field works, the same pattern extends to other sensitive data. Each new field follows the same steps: map the flow, tokenize at entry, and remove the real value from the systems that do not need it. RWA tokenization uses a different kind of token for assets, but the same discipline of keeping the real value in one guarded place applies.

Key takeaways

  • A token is a random stand-in with no link to the real value, so a stolen token is useless
  • The vault is the only place that links tokens to real values, so guard it hardest
  • Tokenization shrinks the number of systems that touch sensitive data
  • Strip sensitive values from logs and backups, not just the database
  • Start with one field in one flow, then extend the same pattern

Frequently asked questions

What is the difference between tokenization and encryption?

Encryption scrambles a value with a key, and anyone with the key can reverse it. Tokenization replaces the value with a random token that has no link to the original, and only the vault can map it back.

Is tokenization the same as crypto tokenization?

No. Data tokenization replaces a sensitive value with a stand-in token to protect it. Crypto or asset tokenization creates a token that represents ownership of an asset, such as property or a fund share.

Can a token be used to steal money?

No, not on its own. A token has no value outside the system that issued it, and it can only be turned back into the real value through the vault, which is protected by strict access rules.

Does tokenization remove the need for encryption?

No. Tokenization protects data in use, but the vault itself and data moving between systems still need encryption. The two methods work together, not as replacements for each other, and most systems use both.

What happens if the token vault is breached?

That is the worst case, because the vault holds the real values. This is why the vault gets the strongest protection: strict access, full logging, separation from other systems, and regular security reviews.

How long does a tokenization project take?

A first field in one flow usually takes weeks, including mapping the data flow and testing refunds and support lookups. Expanding to other fields and systems takes longer, because each one needs its own mapping and testing.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Protecting card numbers or customer records with tokenization? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Data Security & Compliance service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call