Luhn Algorithm Checker

Validate any number with the Luhn (mod-10) checksum.

Free Luhn algorithm checker — validate credit card numbers, IMEI numbers, ICCIDs and any mod-10 checksum, and compute the check digit. Runs entirely in your browser; nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the Luhn algorithm used for?

The Luhn (mod-10) algorithm is a checksum used to catch typos in credit card numbers, IMEI numbers, SIM ICCIDs and many national identification numbers. It does not prove the number is real or active — only that it is internally consistent.

Luhn algorithm (mod-10) checker

The Luhn algorithm is a simple checksum invented by Hans Peter Luhn and used to catch accidental typos in identification numbers — credit and debit cards, IMEI device serials, SIM ICCIDs, and many national IDs all carry a Luhn check digit. This tool tells you instantly whether a number passes, and also computes the check digit, which is handy for generating consistent test data.

How it works

Walking the digits right to left:

  1. Every second digit is doubled. If doubling gives a result over 9, subtract 9 (equivalent to adding the two digits).
  2. All the digits are summed.
  3. The number is valid when the total is a multiple of 10.

To find the check digit for a payload (a number without its final digit), the tool computes the Luhn sum as if a 0 were appended, then the answer is (10 − sum mod 10) mod 10.

Example

Check 4539 1488 0343 6467 (a Luhn-valid test card):

  • Doubling every second digit from the right and reducing values over 9 produces a running total.
  • That total is a multiple of 10 → passes the Luhn check.

Now take a payload 7992739871 with no check digit. The Luhn sum of 79927398710 leaves a remainder, and the tool reports the required check digit as 3, so 79927398713 would pass.

What Luhn protects (and doesn’t)

DetectsMisses
Any single wrong digitThe 09 ↔ 90 transposition
Most adjacent transpositionsWhether the account is real
Most twin-digit errorsWhether the card is active

Privacy: the entire calculation runs in your browser. Nothing you type is uploaded, logged, or stored. A pass means the number is internally consistent — never that it belongs to a real, active account.

Where the Luhn algorithm is used in practice

Hans Peter Luhn invented the algorithm at IBM in 1954, and it was quickly adopted by the fledgling card industry as a lightweight way to catch input errors before sending data to a remote host — a significant concern when network time was expensive. Today, the Luhn check digit appears in:

  • Credit and debit card numbers (Visa, Mastercard, American Express, Discover, and most others)
  • IMEI numbers (the 15-digit identifier for every mobile handset)
  • SIM card ICCIDs (19 or 20 digits identifying a SIM)
  • Canadian Social Insurance Numbers
  • Some national identity numbers and ISIN securities identifiers

The common thread is that these are long numbers prone to transcription errors, and the Luhn check catches the vast majority of single-digit mistakes before any database lookup is attempted.

What the algorithm does and does not guarantee

The Luhn check is deliberately lightweight. It detects all single-digit errors (typing a 3 where a 7 should be) and the majority of transposition errors (swapping two adjacent digits). It misses the swap of 09 and 90 because both produce the same doubled value. It has a roughly 1-in-10 chance of letting a completely random number pass — meaning that if you generate a random 16-digit string, about 10% of them will pass the Luhn check purely by chance.

That is fine for its intended purpose: catching accidental human errors in data entry. It was never designed to prevent deliberate fraud. A would-be fraudster can trivially generate Luhn-valid numbers by appending the right check digit. Card networks add cryptographic authentication on top — the card’s CVV2, the chip’s EMV cryptogram — to handle intentional fraud.

Building valid test card numbers

When building payment forms, developers need numbers that pass front-end Luhn validation without hitting a real card network. The canonical approach is:

  1. Choose a brand prefix (e.g., 4 for Visa, 51–55 for Mastercard)
  2. Fill in arbitrary digits to reach one less than the target length
  3. Compute the Luhn check digit for the payload
  4. Append it

The result passes every Luhn-based validator but refers to no real account. Use these only for testing; treat them as public test data since they are trivially reproducible.