How to use the credit card validator
- Paste or type the card number into the field. Spaces and dashes are removed automatically.
- The credit card checker strips spaces and dashes (any other character is rejected) and identifies the brand from the starting digits (IIN/BIN range).
- It verifies that the total digit count matches the expected length for the detected brand.
- The Luhn algorithm doubles every second digit from the right, subtracts 9 when the result exceeds 9, and sums all values.
- Review the verdict, brand, length check, Luhn check and the detailed calculation table below the results.
How the Luhn algorithm works
The Luhn algorithm (also called the mod 10 check) is used by every major card network to catch typos. Starting from the rightmost digit, double every second digit. If doubling produces a number greater than 9, subtract 9. Sum all the resulting digits. If the total modulo 10 equals zero, the number passes.
Take the test Visa number 4111111111111111. The rightmost digit is at position 1 (not doubled). Position 2 is doubled: 1 x 2 = 2. Position 3 is not doubled: 1. Continuing leftward, the sum of all processed digits is 30. Because 30 mod 10 = 0, the number is structurally valid.
This credit card checker displays every position, original digit, doubled value and final contribution in the table so you can verify the math yourself.
Card brand identification rules
Brands are identified by the Issuer Identification Number (IIN), which is the first few digits of the card number. The tool applies these patterns:
| Brand | Prefix range | Length |
|---|---|---|
| Visa | 4 | 13, 16, 19 |
| Mastercard | 51-55, 2221-2720 | 16 |
| American Express | 34, 37 | 15 |
| Discover | 6011, 65, 644-649 | 16-19 |
| Diners Club | 300-305, 36, 38 | 14 |
| JCB | 3528-3589 | 16-19 |
If a number does not match any prefix, the brand is reported as Unknown. A card can still pass the Luhn check even if the brand is unknown, because the algorithm only validates the digit structure.
What this tool does and does not do
This card number checker validates the mathematical structure of a payment card number. It confirms that the digits satisfy the Luhn formula and that the length and prefix align with a known network. It does not contact any bank, payment processor or database. A valid result means the number could theoretically exist, not that an active account is behind it.
For developers who need sample numbers to exercise checkout forms, use the credit card generator to produce well-formed test data. For validating other financial identifiers, see the IBAN checker or the ABA routing number checker.
Common mistakes when entering card numbers
Transposition errors are the most frequent reason a number fails the Luhn check. Swapping two adjacent digits changes the doubled positions and almost always produces an invalid checksum. The algorithm was designed specifically to catch single-digit errors and nearly all adjacent transpositions.
Another common issue is including extra spaces or dashes that get misread. This tool strips spaces and dashes before processing (letters and other symbols are rejected), so pasting a formatted number like 4111-1111-1111-1111 works correctly. However, letters or special symbols will cause an error because they cannot be part of a valid card number.
Why the Luhn check matters in software
Payment forms use the Luhn algorithm as a fast client-side filter. Running the check in JavaScript before submitting a form prevents unnecessary server requests for obviously mistyped numbers. Because the computation involves only basic arithmetic on individual digits, it executes in microseconds even for 19-digit numbers.
The algorithm is specified in ISO/IEC 7812 and is used beyond credit cards: IMEI numbers for mobile devices, Canadian Social Insurance Numbers and various national identification schemes all rely on the same mod 10 formula. Using a Luhn validator during development helps ensure your input handling matches real-world standards.
Worked examples
| Example | Input | Result |
|---|---|---|
| Visa test number | Card number: 4111111111111111 | Verdict: Valid; Brand: Visa; Length: 16; Luhn check: Pass |
| American Express | Card number: 378282246310005 | Verdict: Valid; Brand: American Express; Length: 15; Luhn check: Pass |
| Mastercard | Card number: 5555 5555 5555 4444 | Verdict: Valid; Brand: Mastercard; Length: 16; Luhn check: Pass |
| Fails Luhn check | Card number: 4111111111111112 | Verdict: Invalid; Brand: Visa; Length: 16; Luhn check: Fail |
FAQ
Does this credit card checker verify that a card is active?
No. It only checks the mathematical structure of the number using the Luhn algorithm and compares the prefix and length against known brand rules. It never contacts banks or payment networks.
What is the Luhn algorithm?
The Luhn algorithm is a checksum formula that validates identification numbers. It doubles every second digit from the right, subtracts 9 if the result exceeds 9, then sums all digits. A total divisible by 10 means the number is valid.
Can I enter card numbers with spaces or dashes?
Yes. The tool automatically removes spaces and dashes before running the validation, so you can paste formatted numbers directly. Letters and other symbols are rejected with an error.
Which card brands does this tool detect?
It detects Visa, Mastercard, American Express, Discover, Diners Club and JCB based on their standard Issuer Identification Number ranges and expected lengths.
Is my card number sent to a server?
No. All processing happens locally in your browser. Nothing is uploaded, stored or transmitted over the network.
Why does a number pass Luhn but show an unknown brand?
The Luhn algorithm only validates the digit structure. If the starting digits do not match any configured brand prefix, the brand is listed as Unknown even though the checksum is correct.