Choose the display from the task

A confirmation screen may show only a country code and final digits, such as +44 •••• ••0018. A support workflow may need more context but should reveal the full value only after an authorized action. Do not use one masking rule everywhere without considering what a user must recognize.

Apply masking to the rendered copy, not the stored canonical value. Replacing database digits with asterisks destroys the identifier and can break future verification or account recovery.

Keep full numbers out of routine logs

Request bodies, validation errors, URLs, analytics events and exception traces can all capture phone values accidentally. Log a stable internal record identifier, operation result and country instead. If correlation is necessary, use a purpose-specific pseudonymous token and manage its secret and retention separately.

The OWASP Logging Cheat Sheet recommends removing, masking, sanitizing, hashing or encrypting personal data where it should not be recorded directly.

Do not put phone numbers in URLs

Query strings and paths commonly appear in browser history, access logs, referrer data and monitoring systems. Send phone input in an appropriate request body over HTTPS and configure observability tooling to redact sensitive fields before export.

Mask consistently at every boundary

  • Admin tables and customer-support views.
  • Application, proxy and provider logs.
  • Analytics properties and event parameters.
  • Error reporting and session replay.
  • Exports, screenshots and notification previews.

Test redaction with nested objects, alternate field names and failure paths. The error path is often where raw input leaks.

Masking is only one control

Limit collection, restrict full-value access, encrypt data in transit and at rest where appropriate, audit exports and delete data when its documented purpose ends. The exact legal obligations depend on jurisdiction and use case; review them with qualified counsel rather than treating a UI mask as compliance.

For the underlying record shape, see how to store phone numbers in a database.

Audit points for masking rules

Review every place a phone value can appear: form fields, confirmation screens, admin tables, email previews, analytics, access logs, error reports and downloaded CSV files. A masking rule in the UI is not enough if the same value is still captured by a session replay script or sent as an event parameter.

Use role-based access for full values and record when a privileged user reveals them. Masking should reduce routine exposure while still letting authorized workflows function. Treat exports as a separate risk because a file can outlive the application permissions that created it.

How this guide connects to the toolkit

This page is written as an implementation reference, not a generic glossary. Use it with the interactive tools when you need to turn an idea into a testable behavior: generate a fixture, format it, validate the structural claim, then record the country and expected result beside your product test. Keeping the explanation and tool output connected helps future reviewers understand why a number was accepted or rejected.

If you copy an example into your own documentation, also copy the safety context. A phone string without its country, source note and limitation can look like a contactable number. The surrounding guidance is part of the value of the fixture.