Skip to main content

Luhn Algorithm Validator

Validate a number against the Luhn (mod 10) checksum — credit cards, IMEIs, SINs and any Luhn-protected identifier — or compute the correct check digit for a number that is missing one. Spaces, dashes and dots are ignored.

Input

Enter the digits (spaces, dashes and dots are ignored). In “Validate” mode include the check digit; in “Compute” mode enter the number WITHOUT its check digit. Everything runs in your browser.

Output

Result
PropertyValue
No data yet
Was this helpful?

Guides

The Luhn algorithm — also called the mod 10 algorithm — is a simple checksum formula used to catch accidental mistakes in identification numbers. It was patented by IBM scientist Hans Peter Luhn in 1960 and is now baked into the ISO/IEC 7812 standard. If you have ever mistyped a credit card number and had a form reject it instantly, before anything was sent anywhere, you have seen Luhn at work.

This tool checks whether a number passes the Luhn test, and can also compute the correct check digit for a number that is missing one. Everything runs entirely in your browser — no number you type is ever uploaded.

What the Luhn check does

Luhn does not prove a number is real, issued, or in service. It only detects the most common typing errors: a single mistyped digit, and most swaps of two adjacent digits. A valid Luhn number is one whose digits, run through the formula below, add up to a multiple of 10. That is a necessary condition for a genuine card or IMEI number, but far from a sufficient one — many valid-looking numbers were never issued to anyone.

How the algorithm works

Reading the number from right to left:

  1. The rightmost digit is the check digit; leave it as-is.
  2. Moving left, double every second digit. If doubling gives a number greater than 9, subtract 9 (the same as adding the two digits of the result — e.g. 8 doubles to 16, then 16 − 9 = 7).
  3. Add up all the digits, doubled and untouched alike.
  4. If the total is divisible by 10, the number is valid.

To generate a check digit for a number that does not have one yet, run the same process over the payload (treating the empty check-digit slot as 0) and pick the single digit that pushes the total up to the next multiple of 10.

How to use this tool

  • Validate a number — paste a full number (card number, IMEI, etc.) and the tool reports whether it passes, the check digit it read, and a best-effort guess at the number's format. If it fails, the result also shows the correct check digit and the corrected number, so you can spot a single-digit typo at a glance.
  • Compute the missing check digit — enter a number without its final check digit and the tool appends the one correct digit, giving you a complete Luhn-valid number.

Spaces, dashes and dots are ignored, so you can paste numbers in whatever grouping you copied them in.

Which numbers use Luhn?

Credit and debit card numbers (Visa, Mastercard, American Express, Discover, JCB and more), IMEI numbers on mobile phones, and Canadian Social Insurance Numbers all carry a Luhn check digit, among many other identifier schemes.

Is it safe to test a real card number here?

The check runs locally in your browser using JavaScript — the number is never transmitted to a server. That said, for validating your own card during checkout you rarely need a separate tool; this is most useful for developers, QA engineers and anyone generating or verifying test data.

luhnmod-10checksumcheck-digitcredit-cardcard-numberimeivalidator

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.