Skip to content
Toolcroft

Credit Card Validator: Luhn Check & Card Type Detector

Validators

Validate credit card numbers using the Luhn algorithm. Detects Visa, Mastercard, Amex, Discover, and more. No data is sent to any server.

Format and Luhn checks only; this does not authorize a payment. Use synthetic test numbers. Never enter real card numbers.

Enter a synthetic test number to check its format. All checks run in your browser.

How to use this tool

  1. Choose a synthetic test number. Select one of the sample buttons or enter a synthetic test number. Never enter a real payment card number.
  2. Review the format checks. Read the detected network, Luhn checksum, and digit length. The number must pass both the checksum and the recognized network length to show Valid.
  3. Use the check digit as a test aid. If the Luhn check fails, the tool shows the check digit calculated from the other digits. This is a format hint for synthetic test data, not payment authorization.

Credit Card Number Validator

Use a synthetic test number to check whether it passes the Luhn checksum, identify the card network (Visa, Mastercard, American Express, Discover, etc.), and verify that the length matches the expected format.

The Luhn Algorithm

The Luhn algorithm (also known as the "mod 10" algorithm) is a simple checksum formula used to validate identification numbers such as credit card numbers. It can detect any single-digit error and most transpositions of adjacent digits. It is not a cryptographic check: it only protects against accidental errors.

Privacy

All validation runs entirely in your browser using JavaScript. Your card number is never sent to any server. The test numbers shown are synthetic numbers for demonstration only.

Luhn algorithm: step-by-step walkthrough

Using the number 4539 1488 0343 6467 as an example:

  1. Starting from the rightmost digit (the check digit), double every second digit going left.
  2. If a doubled value exceeds 9, subtract 9 from it.
  3. Sum all digits (original and doubled).
  4. If the total is divisible by 10, the number is valid.
4 5 3 9 1 4 8 8 0 3 4 3 6 4 6 7  (original)
8 5 6 9 2 4 7 8 0 3 8 3 3 4 3 7  (doubled alternating, subtract 9 if > 9)
Sum = 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
80 mod 10 = 0 -> Valid

Card type IIN/BIN prefixes

NetworkStarts withLength
Visa413, 16, or 19 digits
Mastercard51–55 or 2221–272016 digits
American Express34 or 3715 digits
Discover6011, 622126–622925, 644–649, or 6516 or 19 digits
Diners Club300–305, 36, or 3814 digits
JCB3528–358916–19 digits
UnionPay62, except the Discover range above16–19 digits
Maestro6304, 6759, or 6761–676312–19 digits

These ranges are used only to estimate the network from the number's opening digits. The Discover 622126–622925 range overlaps the broader UnionPay 62 prefix, so this checker checks Discover first and treats other matching 62 prefixes as UnionPay. Issuer ranges may change, and a network match does not verify an account.

Test card numbers for developers

These synthetic numbers pass the Luhn check but are not real cards and cannot be charged:

  • Visa: 4242 4242 4242 4242 (Stripe test card)
  • Mastercard: 5555 5555 5555 4444
  • Amex: 3782 822463 10005
  • Discover: 6011 1111 1111 1117

Frequently asked questions

Does a valid result mean the card is active?

No. A valid result means only that the number passes the Luhn checksum and matches a recognized network prefix and length. This browser-only format check cannot confirm an account, available credit, or whether a payment would be authorized.

Should I enter a real card number?

No. Use synthetic test numbers such as the examples on this page. Never enter real payment card data into this tool or another third-party validator.

Which card networks can this tool recognize?

It checks common prefix patterns for Visa, Mastercard, American Express, Discover, Diners Club, JCB, UnionPay, and Maestro. Network ranges can overlap or change, so the detected name is a format hint rather than confirmation from an issuer.

Browse all validators