About this tool
Validate a number with the Luhn check digit algorithm and guess the card brand, entirely in your browser.
Spaces and hyphens are removed first, so a number can be pasted as printed. If anything but digits remains, the result reads not a number. The check starts at the rightmost digit, doubles every second digit going left, subtracts 9 from doubled values above 9, and passes when the total is a multiple of 10.
Brand detection is separate and uses only prefix and length. Visa: starts with 4, 13, 16 or 19 digits. Mastercard: 51 to 55 or 2221 to 2720, 16 digits. American Express: 34 or 37, 15 digits. Discover: 6011 or 65, 16 or 19 digits. A brand can show even when the checksum fails.