Credit Card Validator (Luhn Checker)
Check the Luhn checksum, detect the brand, and verify length. Format only, test numbers only.
- Runs in your browser
- No sign-up
- No watermark
- No installs
Format check only. This confirms the math (Luhn checksum), the brand prefix, and the length. It does not check whether a card is real, active, issued, or has funds. Enter test numbers only. Never type a real card number into this or any website.
This tool only checks number format and the Luhn checksum locally. It cannot tell whether a card is real, active, issued, or funded. Use published test numbers only; never enter a real card.
What this tool does
Takes a credit or debit card number, strips any spaces and hyphens, and runs three offline checks. First, the Luhn checksum: a mod-10 formula that every issued card number satisfies, which catches typos and transposed digits. Second, brand detection from the Issuer Identification Number (the leading digits): Visa, Mastercard, American Express, Discover, Diners Club, and JCB. Third, a length check against the digit count that brand normally uses. Everything runs in your browser; nothing is sent anywhere.
How to use it
Type or paste a card number into the input. The result updates live as you type. You
will see whether the number passes Luhn, which brand its prefix matches, and whether
its length is expected for that brand. Example: 4111 1111 1111 1111 is
Luhn-valid, detected as Visa, and 16 digits (a valid Visa length). Use
Try a test number to load a known-good sample, or Clear
to reset. Only ever enter published test numbers, never a real card.
Common use cases
- Confirming a checkout or payment form correctly accepts and formats test card numbers.
- Debugging a Luhn implementation by comparing its output against a known-good reference.
- Spotting a single mistyped or transposed digit in a documented test number.
- Teaching how the Luhn checksum and issuer prefixes work, using safe sample data.
- Checking which brand a given IIN or BIN prefix maps to before wiring up form logic.
Common pitfalls
- Passing Luhn does not mean the card is real. The checksum only proves the digits are self-consistent. Countless unissued numbers pass. Only a bank can say a card exists, is active, and has funds, and that never happens in a browser.
- Length can be right while the brand is wrong (or unknown). A 16-digit number that starts with an unrecognized prefix will pass Luhn but report an unknown brand. Brand and length are separate signals from the checksum.
- Do not enter real cards. Even a purely client-side tool should never see a live card number. Build the habit of using the public test numbers your payment provider documents, and keep real card data out of every web form that is not a real checkout.
Frequently asked questions
- What does this credit card validator actually check?
- It checks three things, all offline: whether the digits pass the Luhn checksum (a simple mod-10 formula printed on the back of every issued card number), which brand the leading digits (the IIN or issuer prefix) point to, and whether the total number of digits matches the length that brand normally uses. It does not contact a bank, a payment network, or any server, so it cannot know if a card exists, is active, or has money on it.
- Is a card number that passes Luhn a real, working card?
- No. The Luhn check only proves the digits are internally consistent, so it catches typos and transposed digits. Billions of number combinations pass Luhn without ever being issued to anyone. Only the card network and issuing bank can confirm a card is real, active, and funded, and that check happens during an authorization request, never in your browser.
- Should I ever paste my real card number here?
- No. Never type a real card number into this or any online validator. Even though this page runs entirely client-side and sends nothing anywhere, it is a bad habit to normalize. Use the public test numbers your payment provider documents (for example 4111 1111 1111 1111 for Visa) when you need to exercise a form or checksum.
- How is the card brand detected?
- Brands are identified from the Issuer Identification Number, the first digits of the card. Visa starts with 4. Mastercard uses 51-55 or the newer 2221-2720 range. American Express uses 34 or 37. Discover uses 6011, 65, or 644-649. Diners Club uses 300-305, 36, 38, or 39. JCB uses 3528-3589. If no known prefix matches, the tool reports the brand as unknown.
- What is the expected length for each card brand?
- Visa numbers are usually 16 digits (some legacy cards are 13, and 19 is allowed). Mastercard is 16. American Express is 15. Discover and JCB are 16 to 19. Diners Club is commonly 14, and sometimes 16. ISO/IEC 7812 permits up to 19 digits overall. A number can pass Luhn but still have an unexpected length for its brand, which the tool flags separately.
- How does the Luhn algorithm work?
- Starting from the rightmost digit and moving left, double every second digit. If a doubled value is greater than 9, subtract 9 from it. Sum all the resulting digits together with the untouched ones. If that total is a multiple of 10, the number passes. It was patented by Hans Peter Luhn in the 1950s and is now used for card numbers, IMEI codes, and many national ID schemes.
- Do spaces and hyphens in the number matter?
- No. Cards are often printed in groups of four for readability, and people paste them with spaces or hyphens between groups. This tool strips spaces and hyphens before checking, so 4111-1111-1111-1111 and 4111 1111 1111 1111 are treated the same as the raw digits. Any other non-digit character is reported as invalid input.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.