Skip to content
cosmodev ~/tools/credit-card-validator

Credit Card Validator

Validators & Testers

Validate credit card numbers with the Luhn checksum and detect the issuing brand (Visa, Mastercard, Amex, Discover, Diners, JCB, UnionPay, Maestro). 100% client-side - nothing is transmitted.

Result
Type a card number to see the result.
Brand
Unknown
Luhn check
Fail ✗
Valid
No ✗

Runs 100% client-side - your card number never leaves your browser. Test numbers only.

What it does

The Credit Card Validator checks whether a card number is structurally and mathematically valid using the Luhn algorithm, and identifies the issuing brand (Visa, Mastercard, American Express, Discover, Diners Club, JCB, UnionPay, Maestro) from the number’s prefix and length. This is exactly the kind of front-end check you’d run before submitting a payment form. Everything runs 100% client-side - the number never leaves your browser, so it’s safe even for real cards (though this tool is intended for test numbers).

How to use it

  1. Type or paste a card number into Card number (spaces and dashes are ignored).
  2. Hit Sample to load a known-valid Visa test number.
  3. Read the Luhn check and Valid results, plus the detected Brand.
  4. Copy the formatted number if you need it elsewhere.

Examples

Valid Visa test number

Input: 4111 1111 1111 1111 → Brand Visa, Luhn Pass, Valid Yes.

Invalid (off-by-one)

Input: 4111 1111 1111 1112 → Luhn Fail, Valid No.

American Express (15 digits)

Input: 3782 822463 10005 → Brand American Express, formatted 3782 822463 10005.

Good to know

  • Private: all validation is local - nothing is transmitted or stored.
  • Luhn ≠ real card: the Luhn checksumchecksumA short digest computed from a block of data, compared after transfer or storage to detect corruption. Changing one bit changes the checksum. confirms the number is well-formed, not that the account exists or has funds.
  • Related tools: IBAN Validator, HashHashA one-way function that maps data of any size to a fixed-length digest. Same input, same digest; any change, different digest; not reversible. Type Identifier.
Source code14 languages

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.