Luhn Validator
Validate credit card numbers and other identifiers using the Luhn algorithm. Detect card brand, format with spaces. Runs 100% in your browser.
Spaces and dashes are ignored.
Reference
What is the Luhn algorithm?
The Luhn algorithm (mod-10) is a simple checksum used to validate identification numbers like credit cards, IMEI numbers, and Canadian SINs. From right to left, double every second digit; if doubling produces a number > 9, subtract 9. Sum all digits — if the total is divisible by 10, the number is valid. It catches single-digit errors and most adjacent transpositions.
Algorithm details
Doubling every second digit from the right and summing modulo 10 detects single-digit errors and most transpositions. It is intentionally simple — not a security check.
Common uses
- Form validation — pre-validate card numbers before submission.
- Test data — generate Luhn-valid placeholders.
- Debugging — verify why a card was rejected as malformed.
- Education — learn how checksum algorithms catch errors.
Privacy
All validation runs 100% in your browser. No data is sent to any server.