Luhn Algorithm Checker & Calculator
Validate any number with the Luhn (mod 10) algorithm, compute a missing check digit, identify the card scheme from its BIN, or validate a 15-digit IMEI. Runs entirely in your browser — free, instant, no sign-up.
How it works
The Luhn algorithm — also called the mod 10 or modulus 10 formula — is a simple checksum invented by IBM engineer Hans Peter Luhn in 1954 and patented in 1960. It is now the public-domain standard that guards the last digit of nearly every payment card number, most IMEI device identifiers, some national ID numbers, and many loyalty and gift-card codes. Its only job is to catch the mistakes humans make when they read a number aloud or type it in: a single mistyped digit, or two adjacent digits swapped by accident. It does not prove a number is genuine, issued, or funded.
Here is the exact procedure the tool above runs:
- Write the number down and start from the rightmost digit (the check digit itself).
- Leave the rightmost digit as-is, then double every second digit moving left — that is, the 2nd, 4th, 6th … digits counted from the right.
- Whenever doubling produces a two-digit result (10 to 18), subtract 9 — equivalently, add the two digits together. So 8 doubled is 16, which becomes 7.
- Add up every resulting digit, doubled and untouched alike.
- If that total is an exact multiple of 10, the number is valid under Luhn. If not, it contains an error.
To calculate a missing check digit instead of validating one, you run the same weighting over the digits you already have (with the doubling pattern shifted so the check position lands on an un-doubled slot), take the sum modulo 10, and the check digit is the amount needed to reach the next multiple of 10: (10 − sum mod 10) mod 10. This is what the Calculate check digit button does — paste the number without its final digit and it returns the digit that completes it.
Identifying the card scheme (BIN)
The first six to eight digits of a payment card are the BIN (Bank Identification Number, now formally the IIN). The opening digits alone reveal the scheme, and this tool reads them locally without ever transmitting the number:
| Scheme | Starts with | Usual length |
|---|---|---|
| Visa | 4 | 13, 16, 19 |
| Mastercard | 51–55, or 2221–2720 | 16 |
| American Express | 34, 37 | 15 |
| Discover | 6011, 65, 644–649, 622126–622925 | 16, 19 |
| Diners Club | 300–305, 36, 38, 39 | 14–16 |
| JCB | 3528–3589 | 16, 19 |
| UnionPay | 62 | 16–19 |
Scheme detection is purely a pattern match on the leading digits; it says nothing about the issuing bank or the account behind the number. Because the whole check runs in JavaScript on your own device, the BIN never leaves the page.
IMEI validation
An IMEI (International Mobile Equipment Identity) uniquely identifies a phone on a GSM network and is exactly 15 digits long. The first 14 digits describe the device model and serial number; the 15th is a Luhn check digit computed over the first 14 — the very same mod 10 pass used for cards. The Validate IMEI button therefore enforces the 15-digit length and then runs the Luhn test. You can find your own IMEI by dialling *#06# on the handset. Note the related 16-digit IMEISV variant replaces the check digit with a two-digit software version and is not Luhn-protected.
Where else Luhn shows up — and where it fails
Beyond payment cards and IMEIs, the same mod-10 pass protects many gift card and loyalty numbers, Canadian Social Insurance Numbers, some national provider identifiers in healthcare, and — with letters expanded to numbers first — ISINs for securities. If a system you work with rejects "obviously fine" numbers, checking whether it expects a Luhn digit is a good first debugging step.
It is worth knowing the algorithm's blind spots too: Luhn catches every single-digit typo and most adjacent swaps, but it misses the transposition of 09↔90 and cannot detect two errors that cancel out. Stronger schemes such as Verhoeff or Damm close those gaps at the cost of bigger lookup tables — which is why the simpler Luhn, dating back to a 1960 patent, still dominates wherever the goal is catching honest typing mistakes rather than adversarial tampering.
FAQ
Does a valid Luhn number mean a credit card is real?
No. The Luhn algorithm only proves that a number has no single-digit typo and no simple transposition. It says nothing about whether the card was ever issued, is active, or has funds. A number can pass Luhn and still be completely fake, which is exactly why it is safe to use for basic form validation.
How is an IMEI validated?
A GSM IMEI is 15 digits, and its 15th digit is a Luhn check digit computed over the first 14. This tool runs the same mod 10 pass used for payment cards, so a valid IMEI is one whose digits sum to a multiple of 10 under the Luhn weighting.
Is anything I type sent to a server?
No. The Luhn checker runs entirely in your browser with JavaScript. Nothing is sent over the network or stored. As a precaution, never paste a real card number you do not own.
Validating numbers in bulk or in your own app?
Skip the copy-paste. Our pay-per-use check-digit API validates and computes Luhn, GTIN and IBAN check digits programmatically — with 25 free calls every month.
Embed this tool on your site — free
Run a blog, developer community or internal wiki? Add the Luhn checker to any page by pasting this snippet (please keep the credit link):
Click the code to select it, then copy. Works on WordPress, Shopify pages, Notion (via embed), and any HTML page.
This tool runs entirely in your browser; nothing is sent or stored — but never paste a real card number you don't own. The Luhn check confirms only checksum consistency, not that a card or device is real, issued, or active. Results are provided as-is, without warranty.