Bank Card Validator
Run a digit-by-digit Luhn check, identify the card network and suggest the correct last digit
输入银行卡号
测试号来自支付行业公开文档,用于联调与自测。真实卡号请勿粘贴到任何网页:本工具完全在浏览器本地运算,不发起任何网络请求,也不保存输入。
About this tool
Cashier systems, order tables and payment integrations all run into the question of whether a card number was mistyped. The Luhn check is the last self-test on almost every card number, and this tool lays it out digit by digit and tells you which one to change:
- Luhn check: double every second digit from the right and subtract 9 when the result exceeds 9, with a table showing each original digit, whether it was doubled, its contribution and the final sum
- Network detection: identify UnionPay, Visa, Mastercard, American Express, JCB, Discover and Diners Club from the BIN prefix
- Length check: warn when the length, such as 15, 16 or 19 digits, does not match the usual length for that network, which helps spot a missing digit
- Correct last digit: when the check fails, compute the only final digit that would make the whole number pass
- Structure: show the BIN, the personal account section and the check digit separately
- Tolerant input: spaces and hyphens are ignored, and unusually short, long or non-numeric input is reported
When to use it
- Pre-validate card input during payment development and avoid wasted requests
- Check spreadsheets for transcription errors in finance and operations
- Build valid sample numbers for a test environment
- Confirm that the length a customer reads out matches the network
- Compare the Luhn check with the ID check digit, two different single-digit error codes
Networks and lengths
| Network | Prefix | Usual length | Security code |
|---|---|---|---|
| UnionPay | Starts with 62 | 16 or 19 digits | CVN2, last three on the back |
| Visa | Starts with 4 | 16 digits, older cards 13 | CVV2, last three on the back |
| Mastercard | 51 to 55, 2221 to 2720 | 16 digits | CVC2, last three on the back |
| American Express | Starts with 34 or 37 | 15 digits | CID, four digits on the front right |
| JCB | 3528 to 3589 | 16 to 19 digits | Last three on the back |
| Discover | 6011, 644 to 649, 65 | 16 digits | CID, last three on the back |
| Diners Club | Starts with 30, 36 or 38 | 14 or 16 digits | Last three on the back |
FAQ
- Does passing prove the card is real? No. Luhn is a single-digit error check that only proves internal consistency. It cannot show that the card was issued, is not cancelled or has funds, and it does not verify the holder
- Can it tell me the issuing bank? That needs the BIN allocation tables published by the networks, which change constantly. A static page can only identify the network
- Why does changing the last digit make it pass? With the earlier digits fixed, exactly one final digit makes the sum divisible by 10, so a mistyped last digit is the most common error that can be corrected automatically. An error in the middle requires trying each position
- Can the security code be checked too? CVV2 and CVC2 are derived from issuer keys with unpublished rules. No web page can check them, and forms should not collect them at all
- Is it safe to paste a real card number? Nothing is uploaded, but real card numbers should not be entered into any web page, including this one. Use published test numbers instead
To add a random passphrase to an account, use the random password generator; to mask sensitive form fields, use the privacy mask; the ID number checker uses a similar single check digit and is worth reading alongside. Validation runs entirely in the browser.