Xerobit

Credit Card Checker: Validate Numbers With the Luhn Algorithm

Enter a card number to check whether it passes the Luhn algorithm and matches a known brand pattern. This credit card checker detects Visa, Mastercard, American Express, Discover, Diners Club and JCB cards, verifies the expected length and shows every doubling step in a table. It runs entirely in your browser so no data is uploaded anywhere.

Result

  • Verdict
    Valid
  • Brand
    Visa
  • Length
    16

    Matches brand

  • Luhn check
    Pass
PositionDigitDoubledValue
16488
151-1
14122
131-1
12122
111-1
10122
91-1
8122
71-1
6122
51-1
4122
31-1
2122
11-1

This tool checks structural validity only. It does not verify whether an account exists.

How to use the credit card validator

  1. Paste or type the card number into the field. Spaces and dashes are removed automatically.
  2. The credit card checker strips spaces and dashes (any other character is rejected) and identifies the brand from the starting digits (IIN/BIN range).
  3. It verifies that the total digit count matches the expected length for the detected brand.
  4. The Luhn algorithm doubles every second digit from the right, subtracts 9 when the result exceeds 9, and sums all values.
  5. 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:

BrandPrefix rangeLength
Visa413, 16, 19
Mastercard51-55, 2221-272016
American Express34, 3715
Discover6011, 65, 644-64916-19
Diners Club300-305, 36, 3814
JCB3528-358916-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

ExampleInputResult
Visa test numberCard number: 4111111111111111Verdict: Valid; Brand: Visa; Length: 16; Luhn check: Pass
American ExpressCard number: 378282246310005Verdict: Valid; Brand: American Express; Length: 15; Luhn check: Pass
MastercardCard number: 5555 5555 5555 4444Verdict: Valid; Brand: Mastercard; Length: 16; Luhn check: Pass
Fails Luhn checkCard number: 4111111111111112Verdict: 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.