Join our Newsletter — 33% off our NHI Course

What is an example of format-preserving encryption in practice?

A common example is encrypting a payment card or account number while keeping the same character set and length so downstream systems still accept the value. That preserves application compatibility, but it does not remove the need for strong key management, access control, and careful handling of any place where the original data can be recovered.

What format-preserving encryption is doing in practice

In practice, format-preserving encryption is used when a system must protect sensitive values without breaking the applications that already expect a fixed pattern. The classic example is payment card or account data: the protected value still looks like a valid card or account number to downstream software, even though the underlying value has been transformed. That compatibility is the point, but it also means the protection has to be designed around strict handling of the original data and the key material.

Because the output retains length and character set, format-preserving encryption is usually chosen for fields that cannot easily accept a different datatype or schema. It is often a transitional control in legacy environments, database fields, mainframe integrations, or payment workflows where a full tokenisation redesign would be more disruptive than protecting the field in place. The trade-off is that preserving format does not make the data safe to expose broadly, it only limits how much surrounding code has to change.

That distinction matters because the ciphertext is still sensitive. If a protected number can be decrypted by too many systems, stored in too many places, or accessed without strong segregation, the control becomes mostly cosmetic. For readers comparing this with tokenisation, NHIMG’s Encryption Guide is the better starting point when the question is about preserving usability while encrypting data at rest or in transit, and the Tokenisation and Data Masking Guide helps when the operational goal is to reduce exposure rather than keep decryptable data in circulation.

Where format-preserving encryption is a good fit, and where it is not

FPE works best when the protected field has a rigid format and downstream systems validate that format before accepting the value. Payment card numbers are the most familiar case, but the same pattern can apply to account numbers, customer identifiers, policy numbers, and other structured fields. The value can remain syntactically acceptable while the organisation still controls who can recover the original data.

The limitation is that format preservation can create a false sense of safety. If the same protected value flows into logs, reports, analytics jobs, support tooling, or exports, the encryption only reduces risk when those systems never need the plaintext and the recovery path is tightly controlled. It is also a poor substitute for masking when the business only needs a display value, because a reversible cipher is still a reversible cipher.

In payment environments, format preservation often exists to avoid breaking authorisation, settlement, reconciliation, or legacy host interfaces. That makes it useful for compatibility, but not for broad disclosure. If the field is exposed to many operators or systems, a masked or tokenised representation is often a better default than a recoverable encrypted value.

Key custody and recovery paths decide whether the control actually helps

The security value of format-preserving encryption depends less on the algorithm name than on who can decrypt, where the keys live, and how often they change. If the same credential set can both process the encrypted field and recover the original value, you have preserved compatibility but not meaningfully reduced blast radius. Strong key management, separation of duties, and tightly scoped decryption rights are what keep the design from becoming a convenience layer with weak protection.

Recovery paths deserve special attention because they are often more exposed than the encrypted field itself. Batch jobs, application services, and operational tooling may all have legitimate access to the protected value, and each of those paths becomes part of the trust boundary. If a system must rehydrate the original data, the organisation should treat that access as privileged and explicitly monitored.

For practitioners, NIST SP 800-57 Key Management is the relevant external reference for thinking about key lifecycle and cryptoperiod discipline, while ISO/IEC 27001:2022 Information Security Management maps the control expectation that access to cryptographic material and sensitive data handling must be governed, not improvised.

Risk and Threat Considerations

Format-preserving encryption reduces operational friction, but it can also hide exposure if teams mistake format compatibility for protection. The main risk is that sensitive values remain decryptable and therefore remain attractive to insiders, compromised application accounts, or attackers who reach the recovery path.

Failure mechanism: Overbroad access to the encrypted field, the decryption service, or the key material lets an attacker or insider recover the original value even though the field appears safe in downstream systems.

Impact: Exposure can extend across payment workflows, account systems, logs, exports, and support tooling, which can turn a compatibility control into a credentialed data-recovery path with significant confidentiality and fraud risk.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-57, NIST CSF 2.0 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

Framework Control / Reference Relevance
NIST SP 800-57 key management — Key Management FPE depends on protected key lifecycle and cryptoperiod discipline.
Recommendation — Manage encryption keys with strict lifecycle controls and limited decryption authority.
ISO/IEC 27001:2022 A.5.15 — Access control Recovered values must be restricted to approved roles and systems.
A.8.24 — Use of cryptography FPE is a cryptographic control used to protect structured sensitive data.
Recommendation — Restrict access to recoverable sensitive fields and decryption paths. Apply approved cryptography and define how structured data is protected in use.
NIST CSF 2.0 PR.DS-01 — Data-at-rest is protected FPE protects stored sensitive values while preserving application format.
Recommendation — Protect stored sensitive data with cryptographic controls matched to the data use case.
CIS Controls v8 5 — Account Management Recovery access often depends on tightly governed privileged accounts.
Recommendation — Limit and review accounts that can access or recover protected data.

Practitioner Guidance

What to verify: Confirm whether the encrypted field must be reversible at all, and if it must be, identify every system and role that can trigger rehydration. The practical test is whether a support user, batch job, or integration really needs plaintext access, or only needs a format-compatible surrogate.

Common mistake: Treating format preservation as if it were masking. If the original value can be recovered, the control is about constrained disclosure, not data elimination, so the key and recovery workflow need the same scrutiny as the application that stores the field.

Practitioner takeaway: Use format-preserving encryption when compatibility is a hard requirement, but judge it as a reversible control whose real strength depends on key custody, recovery path restriction, and monitoring of every place the original value can reappear.