Luhn Algorithm Calculator — Credit Card Number Validator
Check whether a credit card number, IMEI, or any numeric ID passes the Luhn mod-10 checksum — and see exactly how each digit is processed.
Strip spaces/dashes and read digits
Double every 2nd digit from the right; subtract 9 if > 9
Sum all processed digits
Check sum mod 10
此計算機如何運作?
The Luhn algorithm doubles every second digit from the right (subtracting 9 if > 9), then sums all digits. A sum divisible by 10 means the number passes. Most credit card numbers, IMEI codes, and several national ID formats use this check to catch single-digit typos. Passing Luhn does not guarantee a number is a real, active account.
公式
How this is calculated
The Luhn algorithm (also called mod-10) is a simple checksum formula invented by Hans Peter Luhn at IBM in 1954. It is used to validate credit card numbers (Visa, Mastercard, Amex, Discover), IMEI numbers, Canadian Social Insurance Numbers, and many other ID formats. It is not a cryptographic tool — it is designed only to catch accidental digit transpositions and single-digit errors.
Starting from the rightmost digit (the check digit at position 1) and moving left, every digit at an even position from the right (positions 2, 4, 6, …) is doubled. If doubling produces a number greater than 9, subtract 9 (which is equivalent to summing the two resulting digits). All the resulting single-digit values — both the doubled-and-adjusted ones and the unchanged odd-position digits — are summed. If the total is divisible by 10, the number passes the Luhn check.
Passing Luhn does NOT guarantee a number is a real card — it only confirms that no single digit has been mis-typed (a transposition of adjacent digits, for example, almost always fails). Actual card validation requires authorisation from the card network.
常見問題
No. Luhn checks only the mathematical checksum — it catches most accidental typos. A number can be mathematically valid but belong to a non-existent or expired card. Real validation requires a live check against the card network.
Credit and debit cards (Visa, Mastercard, Amex, Discover, and most others), IMEI numbers for mobile devices, Canadian Social Insurance Numbers (SIN), Israeli ID numbers, and several national ID formats. The ISO/IEC 7812 standard mandates it for payment cards.
Luhn reliably detects any single digit error and almost all transpositions of two adjacent digits (the only exception is swapping 0 and 9). It does not detect two simultaneous errors or random multi-digit errors.
也稱為
TG we-Calculate Editorial Team. (2026). Luhn Algorithm Calculator — Credit Card Number Validator [Online calculator]. TG we-Calculate. https://we-calculate.com/zh-tw/calculator/luhn-calculator
TG we-Calculate Editorial Team. "Luhn Algorithm Calculator — Credit Card Number Validator." TG we-Calculate. 2026. https://we-calculate.com/zh-tw/calculator/luhn-calculator.
TG we-Calculate Editorial Team, "Luhn Algorithm Calculator — Credit Card Number Validator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/zh-tw/calculator/luhn-calculator
@misc{wecalculate_luhn_calculator, title = {Luhn Algorithm Calculator — Credit Card Number Validator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/zh-tw/calculator/luhn-calculator}}, year = {2026}, note = {TG we-Calculate} }
這個計算機對您有幫助嗎?
