Skip to main content
Check Digit Calculator
Core

Luhn Calculator

Calculate Luhn check digits by doubling alternate digits and summing their values. Validate the final digit with a worked example.

Last updated:

Core Algorithms & Modulus

Calculate or verify Modulus 10 digits.

Length: 10 chars
Calculated Check Character / Checksum
--Ready
Complete Validated Sequence:
--
Arithmetic Steps & Mathematical Specification

Initialising algorithm engine for Luhn Calculator...

How Luhn Calculator Works?

The Luhn Calculator works by doubling every second digit from the right, adding all resulting digits, and choosing the check digit that brings the total to a multiple of 10. The Luhn algorithm, known as the Modulus 10 (Mod 10) algorithm, was patented by IBM scientist Hans Peter Luhn in 1960.

  1. 1Remove spaces, hyphens, and any non-digit characters from the payload.
  2. 2Start at the rightmost payload digit and double it, then double every second digit moving left.
  3. 3Subtract 9 from any doubled value above 9 (12 becomes 3, 18 becomes 9).
  4. 4Add the doubled values and the untouched digits to get the total sum.
  5. 5Compute the check digit as (10 − (sum mod 10)) mod 10 and append it to the payload.
  6. 6Verify a full number by running the same steps over every digit: a valid number gives a sum that ends in 0.

Luhn Calculator Formula

The Luhn formula is Check Digit = (10 − (S mod 10)) mod 10, where S is the sum of the transformed payload digits.

S = Σ f(dᵢ),  f(d) = 2d − 9·[2d > 9] for doubled positions, f(d) = d otherwise
Check Digit = (10 − (S mod 10)) mod 10   (LUHN)
  • dᵢ is the payload digit at position i, counted from the right starting at 1.
  • f(d) doubles digits in odd positions from the right (1, 3, 5…) and leaves even positions unchanged.
  • S is the total of all transformed digits.
  • mod 10 returns the remainder after dividing by 10.
Worked example: payload 7992739871
1 × 2 = 2
7 × 1 = 7
8 × 2 = 16 → 16 − 9 = 7
9 × 1 = 9
3 × 2 = 6
7 × 1 = 7
2 × 2 = 4
9 × 1 = 9
9 × 2 = 18 → 18 − 9 = 9
7 × 1 = 7
Sum S = 67
Check digit = (10 − (67 mod 10)) mod 10 = 3
Complete number = 79927398713

Luhn Calculator Conversion Table

The Luhn conversion table below maps each digit 0–9 to its value after doubling, plus sample payloads converted to complete Luhn-valid numbers.

DigitDoubled valueAfter subtracting 9Sample payloadCheck digitComplete number
0007992739871379927398713
1224539148803436445391488034364
24412345678971234567897
366378282246310005378282246310005
48860111111111111176011111111111117
5101353011133330001353011133330001
6123305693090259049305693090259049
71451818
8167123455123455
91898000280002

What is Luhn Calculator?

A Luhn Calculator is an online tool that computes or verifies the single Luhn check digit at the end of a numeric identifier. The Luhn check digit catches every single-digit typing error and most swaps of two neighbouring digits.

Payment card numbers, International Mobile Equipment Identity (IMEI) numbers, Canadian Social Insurance Numbers (SIN), and US National Provider Identifiers (NPI) all end in a Luhn digit. The Luhn algorithm is defined in ISO/IEC 7812-1 for card numbers and lives in the public domain.

The Luhn algorithm misses one adjacent swap: the pair 09 and 90 give the same sum. The algorithm misses 3 twin errors (22 ↔ 55, 33 ↔ 66, 44 ↔ 77) and every jump transposition such as 123 → 321.

What are the uses of Luhn Calculator?

There are 5 main uses of the Luhn Calculator, including card number testing, IMEI checks, and form validation.

  • Payment card checks: Developers confirm that a 13–19 digit card number passes the Luhn test before sending a payment request to a card processor.
  • IMEI verification: Phone repair shops and resellers confirm the 15th IMEI digit before registering a handset.
  • Form validation: Web forms reject mistyped account, member, or loyalty numbers before submission.
  • Test data creation: Quality assurance teams build valid dummy card numbers for sandbox payment testing.
  • Identifier design: System architects add a Luhn digit to new internal IDs to catch keying errors at no storage cost beyond 1 digit.