Overview
Luhn Algorithm Checker validates and generates numbers using the Luhn (mod 10) checksum.
🔗 https://devnestio.pages.dev/luhn-checker/
What it validates
Credit cards (Visa, Mastercard, Amex, Discover), IMEI codes, ISIN identifiers, and more.
The algorithm
- From the rightmost digit, double every second digit
- If doubling > 9, subtract 9
- Sum all digits — if sum mod 10 = 0, valid
function luhn(digits) {
let sum = 0;
for (let i = 0; i < digits.length; i++) {
let d = digits[i];
if (i % 2 === 1) { d *= 2; if (d > 9) d -= 9; }
sum += d;
}
return sum;
}
Features
- Instant valid/invalid banner with color coding
- Step-by-step digit breakdown table
- Generate mode: enter prefix → get correct check digit
- Card type detection (Visa, Mastercard, Amex, Discover, JCB, Diners)
Top comments (0)