Credit Card Number Validator

Check a card number with the Luhn test and spot Visa, RuPay or Amex

Spaces and dashes are fine. Up to 19 digits.

Runs entirely in your browser. Nothing you type or upload is sent to us or stored. How we handle privacy

This only checks the arithmetic of the number. It can't tell whether a card exists, is active, belongs to anyone or has money on it.
Result
Type or paste a card number
Network
โ€“
Length
0 digits
Luhn check
โ€“
Test numbers for developerstap to try
  • 4111 1111 1111 1111Visa
  • 5555 5555 5555 4444Mastercard
  • 2223 0031 2200 3222Mastercard (2-series)
  • 3782 822463 10005American Express
  • 6073 8499 1234 5674RuPay (made up, passes Luhn)
  • 6011 1111 1111 1117Discover
  • 3622 720627 1667Diners Club
  • 3530 1113 3330 0000JCB
These pass the Luhn check but are not real accounts. Payment gateways publish their own sandbox numbers; use the ones from your gateway's docs when you test payments.

Runs entirely in your browser. Nothing you type or upload is sent to us or stored.

Results are for general guidance. Please check anything important before relying on it. Terms of use

How to Use

  1. Type or paste a card number into the box. Spaces and dashes are fine; the number is grouped as you type (4-6-5 for American Express).
  2. Read the result: whether the number passes the Luhn check, which network its first digits belong to, and whether the length is right for that network.
  3. If it fails, the red note shows which check digit the number needs. Open How the Luhn check worked to see every doubled digit and the total.
  4. Developers can tap Use next to any of the test numbers to fill the box with a number that passes the check.

What this credit card validator checks

This credit card number validator checks whether a debit or credit card number is well formed. It runs the Luhn check that every Visa, Mastercard, RuPay and American Express number has to pass, works out the card network from the first digits, and compares the length with what that network issues. Developers use it to test payment forms; others use it to spot a typo before paying.

It checks the arithmetic of the number and nothing more. It can't tell whether a card exists, has been blocked, belongs to a particular person or has any money or limit on it. Only the issuing bank knows that, and it only answers through a real payment.

How the Luhn check works

The last digit of a card number is a check digit, worked out from all the others with the Luhn formula (also called mod 10), which IBM engineer Hans Peter Luhn devised in the 1950s and which the card numbering standard ISO/IEC 7812 uses.

1. Start from the rightmost digit (the check digit) and move left.
2. Double every second digit: the 2nd, 4th, 6th... from the right.
3. If doubling gives more than 9, subtract 9 (16 becomes 7).
4. Add up all the digits.
5. The number is valid if the total is a multiple of 10.

Take the well-known test number 4111 1111 1111 1111. The doubled digits are the 4 and seven of the 1s: 8 + 7 ร— 2 = 22. The other eight 1s add 8. The total is 30, a multiple of 10, so it passes. Change the last digit to 2 and the total becomes 31, which fails. The tool would then tell you the last digit must be 1.

Luhn catches any single mistyped digit and almost every swap of two neighbouring digits (09 and 90 is the exception). It isn't a security feature: anyone can make up a number that passes.

Card networks by first digits

The first 6 or 8 digits are the Issuer Identification Number (IIN, often called the BIN). They identify the network and the issuing bank.

NetworkStarts withLength
Visa413, 16 or 19
Mastercard51 to 55, 2221 to 272016
RuPay60, 65, 81, 82, 50816
American Express34, 3715
Discover6011, 644 to 649, 6516 to 19
Diners Club300 to 305, 36, 3814 to 19
JCB3528 to 358916 to 19
Maestro50, 56 to 6912 to 19

Some ranges overlap. A card starting with 65 may be RuPay or Discover (the two networks have a partnership), and Maestro shares part of the 6 range. The tool shows the most likely network and mentions the others. In India, cards beginning with 60, 65, 81, 82 or 508 are usually RuPay, the network run by NPCI. RuPay credit cards can also be linked to UPI.

For developers

Run Luhn in your checkout form to catch typos instantly, before a failed payment. Don't block a card just because the network is unknown: new ranges appear, and the payment gateway will reject a bad number anyway. Use the test numbers on this page for form validation only. For actual payment tests, use the sandbox card numbers your gateway publishes, because the gateway only accepts those in test mode.

Never log or store full card numbers. Card data rules (PCI DSS) are strict, and since 1 October 2022 RBI rules have not allowed merchants in India to store customers' card numbers; they keep an encrypted token instead. This page follows the same idea: the number you type stays in memory in this tab. It isn't saved, put in the address bar or sent anywhere.

Frequently Asked Questions

No. It only means the digits pass the Luhn formula and the length fits the network. Whether the card exists, is blocked or has any money or limit can only be checked by the issuing bank during a real payment.

The number stays in this browser tab. It isn't stored, added to the address bar or sent to any server. Even so, there's no need to enter a real card: the check works the same with the test numbers listed on the page.

From the first digits. Visa starts with 4, Mastercard with 51 to 55 or 2221 to 2720, American Express with 34 or 37, and RuPay usually with 60, 65, 81, 82 or 508. The logo on the card confirms it.

A simple checksum used for card numbers and IMEI numbers. Double every second digit from the right, subtract 9 from any result above 9, and add everything up. If the total ends in 0, the number passes.

No. They pass the Luhn check but aren't linked to any account, so a live payment will be declined. For testing a payment integration, use the sandbox numbers from your payment gateway's documentation in test mode.