๐Ÿ’ณ Card Number Validator

The number you enter is processed entirely in your browser and is never sent anywhere.

Enter a card number to see the validation result

A developer tool for checking whether a credit card number is a validly formatted number that passes the Luhn checksum. Useful for testing form input handling or catching typos in a test number. Everything is processed locally in your browser โ€” nothing is sent or stored anywhere.

How to use

  1. Enter the card number you want to check (a test number is fine).
  2. See the estimated card brand, digit count, and Luhn checksum result.

How the calculation works

The last digit of a card number is a check digit calculated from the others. This tool validates the format using that calculation, the Luhn (mod 10) algorithm. Starting from the rightmost digit and moving left, double every second digit (the 2nd, 4thโ€ฆ from the right). If doubling gives 10 or more, subtract 9 (the same as adding its digits). Add everything together; if the total is divisible by 10, the number is correctly formed. The check catches any single mistyped digit and most swaps of adjacent digits, which is why it is used to catch typos. The tool also checks the length is between 12 and 19 digits and makes a simple guess at the card network from the leading digits: 4 for Visa, 51โ€“55 or 22โ€“27 for Mastercard, 34 or 37 for American Express, 35 for JCB, and 6011 or 65 for Discover.

Worked example

The well-known test number 4111 1111 1111 1111 Of the 16 digits, the eight in doubled positions are seven 1s and the leading 4: doubled, that is 2 ร— 7 + 8 = 22. The other eight positions are all 1s, adding 8. The total is 30, divisible by 10, so the number is valid. Changing the last digit to give 4111 1111 1111 1112 makes the total 31, so it is rejected.

Things to be aware of

  • Passing the Luhn check does not mean a real, active card exists โ€” only that the format is valid.
  • Network detection is a simple guess from the leading digits.
  • Do not casually enter or share real card numbers. This tool's processing stays in your browser.
  • There is no payment functionality. For testing, use the test card numbers published by payment providers.

FAQ

Can I make a payment with this tool?

No. This tool only checks the number's format (digit count and checksum) โ€” it has no payment functionality whatsoever.

Is the card number I enter sent to a server?

No. Everything runs entirely in your browser's JavaScript; nothing you enter is ever sent or stored anywhere.

Does passing the Luhn check mean the card is real?

No. The Luhn check only confirms the number is formally well-formed โ€” it does not confirm that the card actually exists or is usable.