Credit Card Validator
Check a card number's Luhn checksum and network format, batch-check a whole list, or generate synthetic test numbers for development — entirely offline, with no connection to any bank or card network.
How to Check a Card Number
Features
What "Valid" Actually Means Here
This is worth stating plainly, because it's the one thing every visitor to a tool like this should understand before reading anything else: a card number passing every check on this page tells you it is correctly formatted — not that it belongs to a real account, that the account has funds, or that a charge against it would succeed. The Luhn checksum is a typo-catching mechanism built into the numbering scheme itself, not a fraud-prevention measure, and it requires no connection to any bank to verify — which is exactly why it can be computed instantly, offline, in a browser tab. Confirming whether a specific card is real, active, and authorized to charge requires an actual payment processor attempting an actual authorization — something no browser-based tool can or should simulate.
The Luhn Checksum, Worked Through
Starting from the rightmost digit and moving left, every second digit gets doubled; any doubled result over 9 has 9 subtracted from it (which is a shortcut for summing its own two digits — 16 becomes 1+6=7, the same as 16-9=7). Every digit in the number — doubled or not — then gets added together, and a genuine card number always produces a total divisible by 10. Take Visa's well-known public test number, 4242 4242 4242 4242: run the doubling and summation across all sixteen digits and the total lands on a clean multiple of 10, confirming the checksum. Change any single digit anywhere in that number and the sum almost never divides evenly again — which is the whole point: it catches a fat-fingered digit or a transposed pair before a request is even sent anywhere, without needing to check anything against a database.
Reading Network Prefixes Without a Live Database
Card networks publish the numeric ranges — called IIN or BIN ranges — that identify which network issued a given number, precisely so that merchants' systems can route a transaction correctly before it even reaches a bank. Visa numbers begin with 4; American Express with 34 or 37; Mastercard occupies a defined band from 51 through 55 plus a newer 2221-2720 range added when the original block began running low. This tool matches against those publicly documented ranges directly, which correctly identifies the overwhelming majority of real-world cards without ever making a network request — the tradeoff is that a live BIN lookup service can additionally tell you the specific issuing bank and country, which requires querying an actual database this tool deliberately doesn't connect to.
Why Length and Grouping Differ From One Network to the Next
It's a common assumption that every card number is 16 digits arranged in four groups of four — Visa, Mastercard, Discover, JCB and UnionPay do follow that pattern, but American Express doesn't, and neither does Diners Club. Amex numbers are 15 digits, not 16, laid out as 4-6-5 rather than 4-4-4-4 — a difference baked into the network's original design decades ago, not an inconsistency in this tool. Diners Club runs shorter still, at 14 digits grouped 4-6-4. Maestro is the least uniform of all: it accepts anywhere from 12 to 19 digits, since it was designed as a flexible debit standard across many issuing banks rather than one fixed format.
This is exactly why the length check runs independently from the network check rather than assuming one fixed length for everything — a 16-digit number with an Amex-style prefix would be immediately wrong despite passing Luhn cleanly, and this tool reports that mismatch explicitly instead of silently accepting a length that doesn't actually belong to the network it detected. Getting the grouping right matters just as much for anything rendering a card number visually: a form that displays every card in 4-4-4-4 chunks regardless of network will split an Amex number in the wrong place, which is a small but real usability bug that shows up constantly in checkout UIs built without per-network formatting logic.
Why Generate Synthetic Test Numbers At All
Building or testing anything that accepts a card number — a checkout page, a billing form, a payment SDK integration — needs realistic input that won't accidentally trigger a real charge. Every major payment processor solves this by publishing their own official test numbers for exactly this purpose; this tool does the equivalent locally, constructing a number from a real network's prefix, filling the middle with random digits, and computing the one check digit that makes the Luhn math come out even. The result passes every format check a real card would, while corresponding to no actual funded account anywhere — safe to paste into a form's input field to confirm validation logic behaves correctly, and useless for attempting an actual purchase, which is exactly the balance a testing tool should strike.
Practical Uses for the Batch Mode
- Cleaning up a test-data fixture: paste a list of numbers used across a test suite and confirm none of them have gone stale or been mistyped.
- Auditing sample data before a demo: quickly confirm every placeholder number in a slide deck or documentation example is a genuinely valid test number, not an accidental real-looking one.
- Teaching the Luhn algorithm: run a batch of known-good and deliberately-broken numbers side by side to show students exactly which check catches which kind of error.
- QA regression checks: verify that a validation library correctly classifies a mixed batch of valid, invalid, and unusual-network numbers the same way this tool does.
Where This Tool Stops
It cannot and does not check whether a number belongs to an open account, whether that account has available credit or funds, whether it's been reported stolen, or whether a specific merchant would accept it — none of that is determinable without an actual authorization request through a real payment network, which is precisely the kind of check this tool is built to avoid needing. If you're building real payment infrastructure, that verification belongs in your payment processor's sandbox environment, not a browser-based formatting tool. For generating strong credentials elsewhere in your stack, see Password Generator; for verifying data integrity more generally, see Hash Generator.