User Rating 0.0
Total Usage 0 times
Spaces and dashes are removed automatically.
Recent Validations
    Is this tool helpful?

    Your feedback helps us improve.

    About

    The Luhn algorithm (also called the Modulus 10 or Mod 10 algorithm) is a checksum formula published by Hans Peter Luhn in 1954 via U.S. Patent 2,950,048. It detects single-digit transcription errors and most transpositions of adjacent digits in numeric identifiers. It is not a cryptographic hash. It does not protect against deliberate fraud. Its sole purpose is catching accidental corruption during manual entry. The algorithm operates in O(n) time where n is the digit count. Every major credit card network (Visa, Mastercard, American Express, Discover, JCB, UnionPay) requires the final digit of the Primary Account Number (PAN) to satisfy the Luhn check. IMEI numbers on mobile devices (15 digits, ITU-T E.212) also use it. Canadian Social Insurance Numbers, some national ID schemes, and ISBNs partially rely on similar modular arithmetic. A failed Luhn check means the number was corrupted during entry or is structurally invalid. A passing check does not guarantee the account exists or is active.

    This tool performs the complete Luhn computation, shows the digit-by-digit breakdown so you can audit each step, detects the card network from IIN/BIN prefixes per ISO/IEC 7812, and can generate the correct check digit for an incomplete number. Limitation: prefix-based card detection covers published BIN ranges and may not identify every issuer sub-brand or co-branded cards.

    luhn algorithm credit card validator check digit calculator mod 10 algorithm card number validation IMEI validator luhn checksum

    Formulas

    The Luhn algorithm processes a number string of n digits d1, d2, …, dn (where dn is the check digit, the rightmost). Starting from the rightmost digit and moving left, double every second digit:

    di =

    {
    2 di 9 if 2 di > 92 di otherwise

    The total checksum is computed as:

    S = ni=1 di

    The number is valid if and only if:

    S mod 10 0

    To generate a check digit dn for a partial number d1dn1, compute the Luhn sum S of the partial digits (treating the missing position as 0), then:

    dn = (10 (S mod 10)) mod 10

    Where di = individual digit at position i, n = total number of digits, S = Luhn checksum, di = transformed digit after doubling rule.

    Reference Data

    Card NetworkIIN/BIN Prefix(es)Length(s)Check AlgorithmExample Prefix
    Visa413, 16, 19Luhn4XXX
    Mastercard51 - 55, 2221 - 272016Luhn5500
    American Express34, 3715Luhn3782
    Discover6011, 644 - 649, 6516 - 19Luhn6011
    JCB3528 - 358916 - 19Luhn3530
    Diners Club Carte Blanche300 - 30514Luhn3000
    Diners Club International3614Luhn3600
    Diners Club USA/Canada5416Luhn5400
    UnionPay6216 - 19Luhn6200
    Maestro5018, 5020, 5038, 630412 - 19Luhn5018
    Mir2200 - 220416 - 19Luhn2200
    Verve506099 - 506198, 650002 - 65002716, 18, 19Luhn5061
    RuPay60, 65, 81, 82, 50816Luhn6521
    IMEI (Mobile Device)TAC (8 digits) + serial15Luhn3568...
    Canadian SIN1 - 9 (province code)9Luhn046...

    Frequently Asked Questions

    No. The Luhn algorithm only verifies structural integrity - it catches accidental typos and single-digit errors. A number can pass the Luhn check and still be completely fictitious. To confirm an account is real and active, an authorization request to the issuing bank via the card network is required. The Luhn check is the first gate, not the only gate.
    The Luhn algorithm detects all single-digit substitution errors (changing any one digit) and most transpositions of two adjacent digits. It fails to detect the transposition of 09 to 90 (or vice versa), because both produce the same Luhn contribution. It also cannot detect some twin errors (e.g., 2255, 3366, 4477) in certain positions. For higher-security applications, the Verhoeff algorithm or Damm algorithm provide strictly stronger error detection.
    Yes. The IMEI (International Mobile Equipment Identity) is a 15-digit number where the last digit is a Luhn check digit, per 3GPP TS 23.003. Canadian Social Insurance Numbers (9 digits) also use the Luhn formula. Enter any numeric string and the tool will compute the checksum. Card network detection only activates when the prefix and length match known IIN/BIN ranges - for non-card numbers, it will report the identifier type as unknown while still validating the Luhn checksum.
    Enter the first n 1 digits of your number. The tool appends a placeholder 0 as the last digit, runs the Luhn sum on the full string, then computes (10 (S mod 10)) mod 10 to find the unique check digit that makes the complete number valid. This is identical to how issuing banks compute the check digit for new card numbers.
    Luhn validity and card network identification are independent checks. The checksum formula works on any digit string regardless of length or prefix. Card network detection relies on matching the IIN/BIN prefix (first 1-8 digits) and total length against published ranges from ISO/IEC 7812 and individual network specifications. Private-label cards, regional networks, or very new BIN ranges may not be in the detection database. The number is still arithmetically valid per Luhn.
    Yes. The tool strips all non-digit characters (spaces, dashes, dots) before processing. The input 4539 1488 0343 6467 is treated identically to 4539148803436467. This matches real-world usage where card numbers are printed in groups of four. However, the algorithm itself operates strictly on the raw digit sequence.