Credit Card Number Validator

Check card numbers with the Luhn algorithm and identify the card brand, without the numbers leaving your browser.

Card numbers
Result
Runs locally in your browser

About the Credit Card Number Validator

Every payment card number carries a check digit computed with the Luhn algorithm, so a mistyped number is usually caught before it reaches a payment processor. This validator runs that check on each number you paste and identifies the brand from the leading digits: Visa, Mastercard, American Express, Discover, JCB, Diners Club and RuPay. Spaces and dashes are ignored.

The algorithm is short enough to follow by hand. Begin at the rightmost digit, which is the check digit, and work left, doubling the value of every second digit. Where a doubled value comes out greater than 9, subtract 9 from it, which is the same as adding its two digits together. Sum every digit, doubled or not, and the number passes when that total divides evenly by 10.

The check is good rather than perfect, and its blind spot is worth knowing. Luhn catches every single-digit mistake and almost every swap of two neighbouring digits, but a transposition of 09 into 90 slips through with the same total. Treat a pass as evidence of a typo-free number and nothing more.

A Luhn-valid number is well-formed, not necessarily real or active; only a payment processor can confirm that. Checking a batch of numbers captured in a form log is the realistic use. Everything runs locally and nothing is transmitted, but avoid pasting real card numbers into any web page as a matter of habit. To create well-formed test numbers for a checkout form, use the Test Card Generator.

How to use

  1. Paste card numbers, one per line.
  2. Read the Luhn result and detected brand.
  3. Use only test numbers.

Common questions

What does the Luhn check prove?
That the number is well-formed with a correct check digit. It does not prove the card exists or has funds.
Are the numbers sent anywhere?
No. The check runs in your browser.
How is the brand detected?
From the leading digits, which each network reserves.