How to use the Card Number Validator (Luhn)
- Enter a card number (test numbers like 4111 1111 1111 1111 work).
- Read whether it passes the Luhn check.
- See the detected card network and length.
What does this tool do?
Card numbers end in a check digit calculated with the Luhn algorithm, which catches most single-digit typos and swapped digits. Developers use this check to validate input before sending it to a payment processor.
The first digits identify the network: 4 for Visa, 51–55 or 2221–2720 for Mastercard, 34 or 37 for American Express.
Why use it?
- Luhn validation.
- Network detection.
- Runs only in your browser.
Use cases
- Validate card fields in checkout forms before submitting.
- Test payment forms with published test numbers.
- Learn how check digits catch typos.
Checking 4111 1111 1111 1111 by hand
Starting from the right, double every second digit. That's seven 1s, which become 2s (14), plus the leading 4, which becomes 8, so 22 in total. The other eight 1s add 8. 22 + 8 = 30, which divides by 10, so the number passes. It's a well-known Visa test number.
Common mistakes
- Thinking a Luhn pass means the card is real or has money — it only checks the format.
- Testing with real card numbers instead of test numbers.
- Storing full card numbers in your own database.
Accuracy and limits
- Passing the check doesn't mean a card is real or active. Use test numbers — never share real card details with websites you don't trust.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
Does it charge or contact the card?
No. It's a maths check done in your browser.
Which errors does Luhn catch?
Any single wrong digit and most swaps of two neighbouring digits.
What do the first digits mean?
They identify the network: 4 for Visa, 51–55 or 2221–2720 for Mastercard, 34 or 37 for American Express.
Content last updated . See how M2Toolkit works.