Skip to content

Credit Card Validator

Check a card number with the Luhn algorithm and detect the brand.

Checked locally — your number is never stored or sent.

How do you validate a credit card number?

The Luhn algorithm doubles every second digit from the right (subtracting 9 if over 9), sums all digits, and the number is valid when the total is divisible by 10. The Luhn check catches most typos but does not confirm the card is real or active. For example, 4242 4242 4242 4242 is a Visa test number that passes.

Understanding your result

The Luhn check catches most typos. It does not confirm the card is real, active or funded.

Formula and method

The Luhn algorithm doubles every second digit from the right (subtracting 9 if over 9), sums all digits, and the number is valid when the total is divisible by 10.

Assumptions and limitations

The Luhn check catches most single-digit typos and detects the brand from the number's prefix pattern, but it does not confirm the card is real, active, funded or belongs to anyone. It never checks the expiry date or CVV, and a passing number can still be entirely fictional, such as a published test card.

Worked example

4242 4242 4242 4242 is a well-known Visa test number that passes the Luhn check.

How to use this tool

  1. Enter the card number (spaces and dashes are ignored).
  2. See whether it passes the Luhn check and its brand.

Common mistakes to avoid

  • Treating a Luhn pass as proof the card works — it only confirms the format.

About the Credit Card Validator

Check whether a card number is well-formed using the Luhn algorithm, and see which brand it belongs to. Everything runs locally — nothing is stored or sent.

Who should use this tool

Developers testing payment forms with test card numbers, and anyone checking for a typo.

Benefits

  • Catch common typos before a payment is attempted
  • Detect the card brand from its number pattern
  • Validate test and sample numbers during development
  • Keep card numbers local with nothing sent or stored

Practical use cases

  • Add basic client-side validation to a checkout form
  • Check known test card numbers while building integrations
  • Confirm a manually entered number has no transposition
  • Teach how the Luhn algorithm works with real examples

Explore all Developer Tools tools

Frequently asked questions

Is my card number stored?

No. The check runs in your browser and the number is never saved or transmitted.

Does a valid result mean the card works?

No. It only means the number is correctly formed; it says nothing about whether the card is active.

How is the card brand detected?

The brand is inferred from the number's leading digits, since each network reserves specific prefix ranges, together with the length. This identifies brands like Visa, Mastercard and American Express reliably, but it only reads the pattern; it does not contact any network or confirm the card is issued or valid for payment.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: