Credit Card Validator
Luhn algorithm validation with card type detection. Numbers are never stored or sent.
Enter a card number above to validate.
About this tool
Credit Card Validator
Credit Card Validator checks a card number against the Luhn algorithm and identifies the card type from its prefix. It runs entirely in your browser.
How to use it
- Enter a card number. Spaces and hyphens are ignored.
- Read whether the checksum passes and which network the prefix indicates.
How the Luhn check works
Starting from the rightmost digit, every second digit is doubled. If doubling gives a number above nine, nine is subtracted. All the digits are then summed, and the number is valid if the total divides evenly by ten.
Card networks are identified by the leading digits: 4 for Visa, 51 to 55 and 2221 to 2720 for Mastercard, 34 and 37 for American Express, 6011 and 65 for Discover.
When it helps
- Catching a typo in a card number before submitting a form.
- Validating card input on the client side to give immediate feedback.
- Generating valid-format test numbers for a payment integration.
- Understanding how checksum digits catch transcription errors.
Common mistakes
- Thinking a passing Luhn check means the card is real. It only proves the digits are internally consistent. It says nothing about whether the account exists, is open, or has funds.
- Using it as fraud prevention. Only the payment processor can authorise a card.
- Entering a real card number into any web page you do not have to. Use a test number instead.
What this tool handles
- Validation is local and nothing is transmitted. Even so, do not enter a live card number here or anywhere it is not required.