ツール ガイド
Finance 無料 サインアップ不要

Credit Card Validator

Validate card numbers with Luhn check and detect card network

ツールを読み込み中…

このツールについて

Paste or type a credit card number — with or without spaces or dashes — and this tool immediately validates it using the Luhn algorithm and identifies the card network (Visa, Mastercard, Amex, Discover, JCB, UnionPay, Diners Club, Maestro). It shows the standard formatted number, the expected CVV length, and the expiry format for the detected network. You can also generate valid Luhn-passing test card numbers for each network — useful for development and QA. No real card data is transmitted; everything runs in your browser.

使い方

  1. 1 Type or paste a card number into the input field. Spaces and dashes are ignored automatically.
  2. 2 The tool shows the Luhn validity, detected network, formatted number, and CVV/expiry format.
  3. 3 Click 'Generate Test Numbers' to get sample Luhn-valid numbers for major networks.
  4. 4 Use the copy button to copy any generated test number to your clipboard.

What "validating" a card number really means

This tool does not check whether a card is real, has funds, or even exists at a bank. It performs two purely mathematical, offline checks: it runs the Luhn algorithm to confirm the digits form a self-consistent number, and it inspects the leading digits to identify the card network. Both are properties baked into how card numbers are constructed, so they can be verified with arithmetic alone — no lookup, no network call, nothing leaves your browser. That is exactly why it is safe to paste a test number here, and why you should never paste a real card number into any online tool, including this one.

The Luhn algorithm, step by step

The Luhn check is a simple checksum that catches the vast majority of single-digit typos and digit swaps. The tool reverses the digits, then for every second digit (the ones in odd positions counting from the right, index 1, 3, 5…) it doubles the value and, if the result exceeds 9, subtracts 9. It sums all the resulting digits. If that total is divisible by 10, the number passes.

Worked example with the short number 4111 1111 1111 1111. Doubling every second digit from the right and reducing values over 9 produces a digit sum that is a multiple of 10, so the tool reports "Valid (Luhn check passed)." Change a single digit — say the final 1 to a 2 — and the sum is no longer divisible by 10, so it immediately flips to "Invalid (Luhn check failed)." That is the whole point: a mistyped card number is caught before a payment form ever submits.

How the network is detected

The first few digits — the Issuer Identification Number — reveal the network. The tool matches these prefixes:

NetworkStarts withTypical lengthSecurity code
Visa413, 16, 193-digit CVV
Mastercard51–55, 2221–2720163-digit CVC
American Express34, 37154-digit CID
Discover6011, 65, 644–649163-digit CVV
JCB3528–3589163-digit CVV
UnionPay6216–193-digit CVN
Diners Club300–305, 36, 38143-digit CVV

Once a network is matched, the tool also formats the number into readable groups — four-four-four-four for most cards, but 4-6-5 grouping for American Express and 4-6-4 for Diners Club, mirroring how the number is printed on the physical card.

The test-card generator

Click "Generate" and the tool produces a set of fresh numbers that pass the Luhn check for each network. It does this by taking the network's prefix, filling the middle with random digits up to one short of the full length, then computing the exact check digit that makes the Luhn sum land on a multiple of 10. These are valid-format dummy numbers for testing forms and payment flows — they are not connected to any account and cannot be charged.

Legitimate use cases

  • Front-end form validation. Catch typos client-side with the Luhn check before sending anything to a payment processor, improving the checkout experience.
  • QA and development. Generate Luhn-valid test numbers to exercise sign-up and billing flows without using real cards. (For end-to-end testing, use your payment provider's official sandbox numbers.)
  • Learning how card numbering works. See network prefixes and the checksum in action.

Critical limitations and common mistakes

  • Luhn-valid does not mean real. Any number that happens to satisfy the checksum passes, including numbers no bank ever issued. Validity here is format-only.
  • It cannot detect fraud, balance, or expiry. Only a payment processor querying the issuing bank can do that. This tool has no way to know.
  • Never enter a real card number. Even though processing is local, treating any tool as a place for real card data is a bad habit. Use the generator's dummy numbers instead.
  • A failed check is usually a typo. If a number you believe is correct fails, re-read the digits — Luhn is specifically designed to flag exactly that kind of error.

よくある質問

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}