Luhn check — credit card / IMEI validator
Validate numbers with the Luhn (Mod 10) algorithm — credit cards (Visa / MasterCard / Amex / Discover / JCB / Diners / UnionPay), IMEI (mobile device IDs), Canadian SIN, and other Luhn-protected identifiers. Paste multiple lines, get bulk validation, auto-detect card brand by IIN prefix, and inspect the checksum trace (double-each-even-digit, digit-sum, total). Useful for test-data generation, form-input sanitisation, data migration QA, and bulk validation before a CSV import. Numbers stay in your browser.
How to use
Paste one number per line (you can drop a column from a CSV — spaces and dashes are stripped automatically). Press Validate to run Luhn (mod 10) + brand detection across every line. Each row shows valid / invalid, the failure reason, and the detected brand. Copy only valid or invalid lines, or download a full CSV report.
In depth
The direct financial risk in card number validation
A credit card PAN (Primary Account Number) combined with expiry date and CVV enables fraudulent transactions. Luhn validation checks the number’s structural validity, but the contexts where this check is needed are payment backend development, front-end form validation, data quality audits, and fraud-number filtering — all of which involve real or near-real card numbers.
CSV validation is particularly high-risk: payment system development and test environments frequently work with test data shaped like real card numbers, and sometimes with production data subsets. Submitting those to an online Luhn checker sends payment-shaped data to an external server.
PCI DSS and the problem with online card number validators
PCI DSS (Payment Card Industry Data Security Standard) requires strict controls over any environment that handles cardholder data. Sending a real card number to a third-party service is a straightforward compliance violation. Even test numbers — those that pass Luhn but don’t represent real cards — should follow the same handling discipline. Building a habit of using external tools for “test” data makes it easier to accidentally send real data through the same pipeline.
Beyond compliance, the structural risk is the same as with any financial identifier tool: a service that logs requests receives the numbers in those requests, and numbers that pass Luhn look exactly like usable card numbers regardless of whether they are.
Luhn mod-10 arithmetic runs entirely in browser JavaScript
The Luhn algorithm is pure integer arithmetic: double every second digit from the right, sum the digit-level values, check divisibility by 10. This tool implements that in JavaScript. Brand detection maps IIN prefixes and lengths to a static table of major issuers (Visa, MasterCard, Amex, Discover, JCB, Diners Club, UnionPay, Maestro) — no external lookup.
Numbers live only in page memory throughout validation. Real card numbers, test numbers, and IMEI strings (also 15-digit Luhn numbers) can all be validated without leaving the browser.
Practical use in payment system development
Front-end form validation development: verify that your test case list includes both valid and invalid numbers of each brand. Data quality audits: paste a card-number column from a CSV export and identify invalid entries before loading them into a system. The Valid-only / Invalid-only copy functions let you pipe the filtered result into the next step; the CSV download records the full report. The entire workflow runs locally. Pair with regex-test when fine-tuning the form-input pattern, and email-validate when the same record carries billing email fields.
The Luhn algorithm in context: ISO/IEC 7812 card structure and patent history
The Luhn algorithm (also called modulus 10 or mod 10) was invented by Hans Peter Luhn at IBM in 1954 and granted as US Patent 2,950,048 in 1960; it has been in the public domain since the patent expired. Its design goal was to catch keypunch entry mistakes mechanically: (a) all single-digit substitution errors and (b) all adjacent two-digit transpositions except 09 ⇔ 90 are detected with 100% reliability. It does not detect arbitrary three-digit transpositions or substitutions that happen to produce the same checksum. The algorithm offers no cryptographic strength — it is a typo catcher, not a tamper detector.
Credit card numbers are structured by ISO/IEC 7812. The leading digit is the Major Industry Identifier (MII): 4 indicates financial-industry Visa, 5 indicates banking (Mastercard), 6 covers Maestro / Discover, and so on. The first 6 to 8 digits form the Issuer Identification Number (IIN/BIN) used to identify the card brand and issuing bank; the middle digits are the individual account number; and the final digit is the Luhn check. The IIN-prefix detection in this tool follows the ISO/IEC 7812 layout — Visa is 4 with 13/16/19 digits, Amex is 34 or 37 with 15 digits, JCB is 35 with 16/19 digits — matched against a static brand table.
What Luhn validity does and does not prove
A passing Luhn check is not a guarantee that a card exists. The number can still (a) reference an unallocated IIN range, (b) belong to a closed account, (c) be expired, or (d) belong to an active card that refuses the specific authorization. Confirming a number is genuinely usable requires sending it to a payment gateway (Stripe, Adyen, PayPay) with an Authorize-only request — a zero-amount or small-amount hold — and that step is intentionally outside this tool’s scope.
Conversely, some real identifiers occasionally fail standard Luhn rules. IMEI (15 digits: 8-digit TAC, 6-digit serial, 1-digit Luhn check) is defined by ETSI TS 123 003 and normally passes Luhn, but exception ranges exist for specific carrier management codes. Canada’s SIN numbers also use Luhn, but numbers beginning with 9 are reserved for temporary workers and follow distinct allocation rules. This tool implements the canonical Luhn algorithm; domain-specific overrides need to be layered on top. In production payment systems, Luhn is the first gate — IIN whitelists, expiry validation, 3D Secure, and tokenisation form the layers behind it.
FAQ
- How does Luhn work?
- Starting from the rightmost (check) digit, double every digit at an even position (2nd, 4th, 6th from the right). If the doubled value is two digits, sum those digits. Sum every result; if the total is divisible by 10, the number is valid. Used by credit cards, IMEI, Canadian SIN, and many other IDs.
- Does passing Luhn mean the card is real?
- No. Luhn is a format check, not an issuer check. It catches typos and random input well, but invalid numbers can pass Luhn by chance. Real issuance verification requires a payment processor API (Stripe, Adyen, …).
- How is the brand detected?
- By IIN prefix and length. Examples: 4xxx with 16 digits = Visa, 34xx/37xx with 15 digits = Amex, 51-55xx with 16 digits = MasterCard. We ship a small built-in BIN table (Visa, MasterCard, Amex, Discover, JCB, Diners, UnionPay, Maestro), not an exhaustive registry.
- Can it check IMEI?
- Yes — IMEI is a 15-digit Luhn number. Paste it into the same input. We don't report a brand for IMEI, but '15 digits + Luhn passes' is a strong hint.
- Is anything uploaded?
- No. Everything runs in your browser.
How to verify nothing is uploaded
This tool never sends your input outside your browser. The pages below explain how it works, how to audit it, and how the site is run.
Related tools
Regex tester — live match & replace preview
Type a pattern and flags to highlight matches in the test string in real time. Capture groups and named groups are listed for every match, and there's a replace preview using $1 etc. Runs entirely in your browser.
Email validate — RFC 5322 / disposable detection / role detection
Paste email addresses (one per line) to run RFC 5322-style syntax validation (local / domain / TLD / length limits), disposable-provider detection (mailinator / 10minutemail / guerrillamail and 100+ others built in), role-address detection (admin / support / postmaster / no-reply, etc.) and Gmail dot/+ tag normalisation — all in one pass. Results display as a table and export to CSV. Useful for sanitising lists before MailChimp / Stripe import, cleaning form-collected addresses, and predicting bounces before sending. Addresses stay in your browser — no upload.
Hash generator — SHA-1 / 256 / 384 / 512
Generate SHA-1, SHA-256, SHA-384, and SHA-512 digests from text in parallel. Powered by the Web Crypto API and runs entirely in your browser.
UUID parser — version, variant, timestamp
Paste a UUID and inspect its version (v1–v8 / Nil / Max), variant (RFC 9562 / Microsoft / legacy NCS), canonical / compact / braced / URN forms, integer (BigInt), and raw bytes — all at once. UUID v1 and v6 expose the embedded timestamp + node MAC, and UUID v7 reveals the Unix epoch ms used as the prefix. Braces, whitespace, the urn:uuid: prefix, and mixed case are normalized automatically. Nothing leaves the browser.