Boneyard Tools

Credit Card Validator (Luhn Check)

Paste a card number to check whether it passes the Luhn checksum and to see the detected card type. Everything runs locally in your browser, so the number you enter never leaves your device.

How to validate a credit card number

  1. Type or paste the card number. Spaces and dashes are ignored as you go.
  2. Watch the valid or invalid badge update live, along with the detected card type.
  3. Use the formatted output and Copy button if you need a clean, grouped number.

Examples

A valid Visa test number

4242 4242 4242 4242
valid: true, cardType: Visa, length: 16

A number that fails the Luhn check

4242 4242 4242 4241
valid: false, cardType: Visa

Frequently asked questions

What does this credit card validator actually check?

It checks the structure of the number only: that it passes the Luhn checksum and has 12 to 19 digits, and it guesses the brand from the leading digits. It does not check whether the card is real, active, or has any funds. A valid result just means the number is well-formed.

What is the Luhn algorithm?

The Luhn algorithm, or mod 10 check, is a simple checksum used by most payment cards. It doubles every second digit from the right, sums all the digits, and the number is valid when that total is a multiple of 10. It catches most accidental typos but is not a security feature.

How is the card type detected?

The card type comes from the issuer identification number, the first few digits of the card. For example numbers starting with 4 are Visa and 34 or 37 are American Express. The brand is detected from the prefix even when the number itself fails the Luhn check.

Is my card number sent anywhere or stored?

No. All validation happens locally in your browser using client-side JavaScript. The number you type is never uploaded, logged, or stored, so it never leaves your device.

Should I enter a real credit card number here?

There is no need to. The tool is designed for testing card-handling code and forms, so use the published test numbers from Visa, Mastercard, and others. Because validation only proves the format is correct, entering a real number tells you nothing extra.

Why is a correctly typed card number reported as invalid?

Either a digit is wrong so the Luhn checksum no longer adds up, or the length falls outside the 12 to 19 digit range. Double-check each digit. Remember that passing this check still does not guarantee the card can be charged.

Related tools