Mask a credit card number

Mask a credit card number keeping only the last 4 digits, and check its validity using the Luhn algorithm — handy for a receipt, support ticket, or demo.

Example:
Spaces are ignored. Nothing is sent to a server.

How it works

When sharing an example receipt, a support screenshot, or a demo, it's important to never show a full credit card number. This tool keeps only the last 4 digits, replaces the rest with dots, and also checks whether the number satisfies the Luhn algorithm — the mathematical check card issuers use to catch entry errors.

What is the Luhn algorithm?

It's a simple check formula that doubles every second digit starting from the right, adds up all the resulting digits, and verifies that the total is a multiple of 10. It is used to detect typos, not to verify that a card is actually active or belongs to an existing account.

Does a “Luhn-valid” number mean the card is real?

No. The Luhn test only validates the mathematical structure of the number, not its actual existence with a bank. Many test numbers (such as those used in development) are deliberately designed to pass this check.

Masking and validation are performed entirely in your browser via WebAssembly — the full number never leaves your machine.