Free Credit Card Number Validator (Luhn Checksum)

Paste a card number to run the Luhn checksum and detect its brand by prefix and length. It runs entirely in your browser for developers testing formats β€” no card data is ever stored or sent.

Runs entirely in your browser. This is a checksum and format checker β€” it never stores, sends, or processes any payment. Use test numbers, not a real card.

Result

βœ“ Passes Luhn check

Detected brand
Visa
Digit count
16
Luhn checksum
Pass

A passing Luhn check means the number is well-formed, not that the card exists or is active.

Quick answer

The Luhn algorithm is a simple checksum that catches most single-digit typos in card numbers: doubling every second digit from the right, summing the digits, and confirming the total is a multiple of 10. This tool runs that check and identifies the brand from the prefix and length. Passing Luhn means the number is well-formed β€” not that a real, active card exists.

Formula & method

After stripping spaces and dashes, the number is checked for length (12–19 digits). The Luhn (mod-10) test then walks the digits right to left, doubling every second one and subtracting 9 from any result over 9, then sums them; a total divisible by 10 passes. The brand is inferred from the issuer prefix and length β€” Visa starts with 4, Mastercard with 51–55 or 2221–2720, American Express with 34 or 37, and Discover with 6011, 65, 644–649, or 622. All computation happens locally in your browser.

Examples

Example 1: Valid Visa test number
Input
4111 1111 1111 1111
Result
Passes Luhn Β· Brand: Visa Β· 16 digits
Why
Spaces are stripped, the 16-digit Luhn sum is a multiple of 10, and the leading 4 with length 16 identifies Visa.
Example 2: Valid Amex test number
Input
378282246310005
Result
Passes Luhn Β· Brand: American Express Β· 15 digits
Why
The 37 prefix with a 15-digit length is American Express, and the checksum passes.
Example 3: One digit wrong β€” fails
Input
4111 1111 1111 1112
Result
Fails Luhn Β· Brand: Visa Β· 16 digits
Why
Changing the final digit from 1 to 2 breaks the mod-10 total, so Luhn rejects it even though the Visa prefix is still detected.
Example 4: 2-series Mastercard
Input
2223003122003222
Result
Passes Luhn Β· Brand: Mastercard Β· 16 digits
Why
Numbers in the 2221–2720 range are Mastercard's newer BIN block; the checksum passes and length is 16.

When to use this tool

  • Validating card-number formatting in a checkout form before sending it to a payment processor.
  • Generating or checking test card numbers (like 4111 1111 1111 1111) while building and debugging payment flows.
  • Catching transposed or mistyped digits in data-entry, import, or migration scripts.
  • Teaching or learning how the Luhn checksum and issuer prefixes work.

Common mistakes

  • Assuming a passing Luhn check means the card is real or active. Luhn only catches typos; it cannot tell you whether a card was ever issued or has funds.
  • Forgetting to strip spaces or dashes first. The number 4111-1111-1111-1111 must be reduced to digits before the checksum is run.
  • Treating brand detection as authoritative. Prefix ranges (BINs) change over time, so length-and-prefix rules approximate the brand rather than guarantee it.
  • Using a real card number. This is a developer format checker β€” use published test numbers, never a live card.

Frequently asked questions

Does this store or send my card number?

No. The check runs entirely in your browser with JavaScript β€” nothing is uploaded, logged, or stored. That said, you should still only enter published test numbers, never a real card.

Does a valid result mean the card works?

No. The Luhn algorithm only verifies that the number is well-formed and free of common typos. It cannot tell you whether the card was ever issued, is active, or has available funds β€” only the issuing bank can confirm that.

What is the Luhn algorithm?

It is a mod-10 checksum invented by Hans Peter Luhn. From the rightmost digit, every second digit is doubled (subtracting 9 if the result exceeds 9), all digits are summed, and the number passes if the total is divisible by 10. It detects almost all single-digit errors and many adjacent transpositions.

How is the card brand detected?

From the issuer identification number (the leading digits) and the total length. For example, 4 with 13/16/19 digits is Visa, 34 or 37 with 15 digits is American Express, and 51–55 or 2221–2720 with 16 digits is Mastercard. These ranges are heuristics and can change.

Do spaces and dashes matter?

No. The tool strips all spaces and dashes before checking, so 4111 1111 1111 1111 and 4111-1111-1111-1111 are treated the same as the raw digits.

Why does my brand show as Unknown?

The prefix or length didn't match any rule the tool knows. The Luhn result is still shown, but the issuer ranges here cover the major networks (Visa, Mastercard, Amex, Discover, Diners, JCB, Maestro) and not every regional or private-label card.

Can it validate the CVV or expiry date?

No. The CVV and expiry are not part of the card number and have no checksum relationship to it. This tool only validates the primary account number (PAN) using Luhn and detects the brand.

Sources & references

External references open in a new tab. We are independent and not affiliated with these organizations.

  • βœ“ Free to use
  • βœ“ No sign-up required
  • βœ“ Runs entirely in your browser β€” nothing is uploaded.
  • βœ“ Formula and method shown above

Provided β€œas is” for general information only β€” results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.

Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.

Related tools

Embed this tool on your site

Free to embed, no sign-up. Paste this code where you want the credit card number validator (luhn) to appear: