Security & Privacy
Credit Card Number Validator
Check whether a card number is correctly formatted — Luhn checksum, length and card brand (Visa, Mastercard, Amex, Discover…). For testing forms; nothing is stored or sent.
How to use
- 1Type or paste a card number (spaces and dashes are fine).
- 2See the detected brand and whether it passes the Luhn check.
How it's calculated
The Luhn algorithm doubles every second digit from the right (subtracting 9 if over 9) and checks the total is divisible by 10. The brand comes from the leading digits (IIN) and length.
Frequently asked questions
Does a valid result mean the card is real?
No — it only means the number is well formed. Only the card issuer can say whether an account exists or has funds.
Is it safe to type a card number here?
The check runs entirely in your browser and nothing is sent or saved. Still, use test numbers such as 4111 1111 1111 1111 when testing.
What are test card numbers?
Payment providers publish numbers like 4242 4242 4242 4242 (Visa) and 5555 5555 5555 4444 (Mastercard) that pass Luhn but can't be charged.
What Luhn actually catches
The Luhn checksum exists for one narrow purpose: catching accidental typos and transpositions, not fraud. Starting from the rightmost digit, every second digit is doubled (subtracting 9 if that makes it two digits), and the total must be divisible by 10. It catches a single mistyped digit and most adjacent-digit swaps almost every time — which is exactly the class of error a human makes typing a 16-digit number into a form. It says nothing about whether the card exists, is active, or belongs to the person typing it.
Worked example: Credit Card Number Validator
4111 1111 1111 1111 is a published Visa test number: it matches Visa's leading-digit pattern (starts with 4), has the correct length (16), and passes the Luhn check — so the tool reports "Valid format." Flip the last digit to 4111 1111 1111 1112 and the Luhn sum no longer divides evenly by 10; the tool reports "Invalid" with the hint "Fails the Luhn checksum," even though the brand and length still look fine. That's the entire value of the check in practice — it's built to catch exactly that kind of single-digit fat-finger before it reaches a payment form.
How brand detection works, and where it gets ambiguous
Brand is guessed from the leading digits (the issuer identification number) plus the total length — a 16-digit number starting with 4 is Visa, one starting 51–55 or in Mastercard's expanded 2221–2720 range is Mastercard, 34 or 37 is Amex at 15 digits, and so on. These ranges were assigned by the card networks and occasionally get extended (Mastercard's 2-series range is a relatively recent addition), so a brand-new range could theoretically show as "Unknown" here even on a well-formed card. Use this to sanity-check a form during development, not as the authority on which network issued a card.
Spaces and dashes are removed before the length check
The box starts with 4111 1111 1111 1111. Spaces and dashes are stripped, so a dashed Mastercard test number is read as digits only. You need between 8 and 19 digits or the page asks you to enter that range and shows nothing else. The issuer prefix line is the first six digits that remain. A number that matches no brand is labeled Unknown, and for those the length is accepted once it is at least 12 digits. A known brand with the wrong length is Invalid, and the hint names that brand. A Luhn failure says Fails the Luhn checksum even when the brand and the length would otherwise be fine.
Related tools
- 2FA / TOTP Code Generator
Generate time-based one-time passwords (TOTP) from a Base32 secret — to test two-factor authentication setups, with SHA-1/256/512, 6–8 digits and custom periods.
- Random MAC Address Generator
Generate random, valid MAC addresses (locally administered, unicast) for testing, virtual machines and network privacy — in any common format.
- Identity Theft & Data Breach Checklist
Step-by-step checklist for what to do after identity theft or a data breach — passwords, credit freezes, fraud alerts, reports and monitoring (US, UK and EU).
- How to Freeze Your Credit (US)
How to freeze (and unfreeze) your credit at Equifax, Experian and TransUnion — free by law — plus the lesser-known bureaus worth freezing too.
- Test IBAN Generator
Generate random, checksum-valid IBANs for software testing — for Germany, France, the Netherlands, Spain, Italy, the UK and more.
- Credit Card Payoff Calculator
See how long it will take to pay off a credit card and the total interest — or the monthly payment needed to be debt-free by a target date.