Skip to content
Credit cards

Credit Card Validator

Validate credit card numbers instantly. Check if credit card numbers are valid and identify card type (VISA, MasterCard, AMEX, Discover) using Luhn algorithm.

Validation Mode

Spaces, dashes, and special characters are automatically handled.

Try Sample Test Cards:

Luhn Validation Status

VALID CARD NUMBER

Visa (16 digits) • Modulo 10 Checksum = 60 (mod 10 = 0)

Luhn Valid
Visa

4532 7500 1234 5673

Card Network

Visa

Digits Length

16 digits

Check Digit

3

Detected Network

Visa

Card Length

16 Digits

IIN / BIN Prefix

453275

ISO/IEC 7812 Identification Details

Major Industry Identifier (MII): Banking & Financial (Visa)

Issuer Identification Number (IIN): Prefix 453275

Luhn Check Digit: 3 (Computed requirement: 3)

Security Code (CVV): Expected 3 digits

Luhn Checksum Contribution Split

  • Doubled Digits (Even Positions)3355.0%
  • Unaltered Digits (Odd Positions)2745.0%

Luhn Algorithm Mathematical Verification

Step-by-step breakdown of how the Mod 10 checksum is calculated.

  1. Step 1: Sanitize & Inspect Number Structure

    Input has 16 digits. Identified Brand: Visa (MII: Banking & Financial (Visa)). IIN/BIN Prefix: 453275.

  2. Step 2: Double Every Second Digit from Right to Left

    f(d)={dfor odd positions from right2d9for even positions if 2d>92dfor even positions if 2d9f(d) = \begin{cases} d & \text{for odd positions from right} \\ 2d - 9 & \text{for even positions if } 2d > 9 \\ 2d & \text{for even positions if } 2d \le 9 \end{cases}

    Starting with the second digit from the right, double every alternating digit. If doubling results in a value greater than 9, subtract 9 (sum the individual digits). Calculated digit contributions: (4 \times 2 \to 8) + 5 + (3 \times 2 \to 6) + 2 + (7 \times 2 \to 5) + 5 + (0 \times 2 \to 0) + 0 + (1 \times 2 \to 2) + 2 + (3 \times 2 \to 6) + 4 + (5 \times 2 \to 1) + 6 + (7 \times 2 \to 5) + 3

  3. Step 3: Sum All Digits and Apply Modulo 10

    f(di)(mod10)=60(mod10)=0\sum f(d_i) \pmod{10} = 60 \pmod{10} = 0

    Sum of all processed digits = 60. Modulo 10 result: 60 mod 10 = 0. Because the remainder is 0, the card passes the Luhn Mod 10 algorithm check!

Digit-by-Digit Luhn Computation

Every 2nd digit counting from the right is doubled (subtracted by 9 if > 9)

PosDigitOperationSum Contribution
#1 (16 from right)4× 2 = 8+8
#2 (15 from right)5unaltered (odd pos)+5
#3 (14 from right)3× 2 = 6+6
#4 (13 from right)2unaltered (odd pos)+2
#5 (12 from right)7× 2 = 14 → 14 - 9+5
#6 (11 from right)5unaltered (odd pos)+5
#7 (10 from right)0× 2 = 0+0
#8 (9 from right)0unaltered (odd pos)+0
#9 (8 from right)1× 2 = 2+2
#10 (7 from right)2unaltered (odd pos)+2
#11 (6 from right)3× 2 = 6+6
#12 (5 from right)4unaltered (odd pos)+4
#13 (4 from right)5× 2 = 10 → 10 - 9+1
#14 (3 from right)6unaltered (odd pos)+6
#15 (2 from right)7× 2 = 14 → 14 - 9+5
#16 (1 from right)3unaltered (odd pos)+3
Total Checksum Sum:60
Modulo 10 Remainder:0 (PASS)
Report tool

Understanding credit card number validation and the Luhn algorithm

Payment card numbers issued across the globe follow structural and mathematical standards established by the International Organization for Standardization (ISO/IEC 7812). Far from being arbitrary digits, credit card numbers encode the issuing industry, the card network, the specific financial institution, the cardholder account number, and a mathematical verification digit known as the Luhn check digit.

Validating a credit card number instantly catches accidental keystroke errors, transposed numbers, and corrupted digits before a transaction request ever reaches a payment processor. For software developers and QA testers generating synthetic test datasets, pairing this validator with our credit card generator allows end-to-end verification of checkout forms. If you are managing active card debt or planning payment schedules, explore our credit card payoff calculator, calculate monthly carrying costs with our credit card interest calculator, or assess minimum obligations using our credit card minimum payment calculator.

How the Luhn algorithm (Mod 10) checksum works

Developed in 1954 by IBM computer scientist Hans Peter Luhn, the Luhn formula (also known as the Modulo 10 or Mod 10 algorithm) is a public domain checksum formula used worldwide to validate primary account numbers (PANs) on credit cards, debit cards, IMEI numbers, and national identification documents.

The mathematical validation steps

Given a sequence of nn numerical digits represented as d1,d2,,dnd_1, d_2, \dots, d_n:

  1. Begin at the rightmost digit (the check digit, position 1 counting from the right) and move leftwards toward the beginning of the number.
  2. Leave the first digit (the check digit) unaltered. Double the numerical value of every second digit (position 2, 4, 6, 8, etc., from the right).
  3. If the product of the doubling operation exceeds 9 (meaning it is a two-digit number between 10 and 18), subtract 9 from the product. This produces the identical result as adding the two individual digits together (for example, 2×8=16    1+6=7=1692 \times 8 = 16 \implies 1 + 6 = 7 = 16 - 9).
  4. Sum all processed values together to compute the total checksum SS:
S=k=1nf(dnk+1,k),where f(d,k)={dif k is odd2d9if k is even and 2d>92dif k is even and 2d9S = \sum_{k=1}^{n} f(d_{n - k + 1}, k), \quad \text{where } f(d, k) = \begin{cases} d & \text{if } k \text{ is odd} \\ 2d - 9 & \text{if } k \text{ is even and } 2d > 9 \\ 2d & \text{if } k \text{ is even and } 2d \le 9 \end{cases}

The card number is considered mathematically valid under the Luhn algorithm if the total sum is evenly divisible by 10 (its remainder modulo 10 equals zero):

S0(mod10)    Smod10=0S \equiv 0 \pmod{10} \iff S \bmod 10 = 0

Worked step-by-step validation example

To see the Luhn checksum in action, consider the standard 16-digit Visa card number 4532 7500 1234 5673:

Position (Left to Right)DigitPosition from RightOperation AppliedAdded Value
#1416 (Even)4 x 2 = 88
#2515 (Odd)Unaltered5
#3314 (Even)3 x 2 = 66
#4213 (Odd)Unaltered2
#5712 (Even)7 x 2 = 14 (14 - 9)5
#6511 (Odd)Unaltered5
#7010 (Even)0 x 2 = 00
#809 (Odd)Unaltered0
#918 (Even)1 x 2 = 22
#1027 (Odd)Unaltered2
#1136 (Even)3 x 2 = 66
#1245 (Odd)Unaltered4
#1354 (Even)5 x 2 = 10 (10 - 9)1
#1463 (Odd)Unaltered6
#1572 (Even)7 x 2 = 14 (14 - 9)5
#1631 (Check Digit)Unaltered3

Summing all 16 contributions yields:

8+5+6+2+5+5+0+0+2+2+6+4+1+6+5+3=608 + 5 + 6 + 2 + 5 + 5 + 0 + 0 + 2 + 2 + 6 + 4 + 1 + 6 + 5 + 3 = 60

Evaluating the modulo 10 remainder: 60mod10=060 \bmod 10 = 0. Because the remainder is exactly 0, the card number passes the mathematical validation check. If any single digit were altered (for example, typing a 5 instead of 3 as the last digit), the sum would become 62, yielding 62mod10=262 \bmod 10 = 2, flagging the number as invalid.

Payment card anatomy: ISO/IEC 7812 standards

Under ISO/IEC 7812, primary account numbers (PANs) are structured into three distinct logical segments:

1. Major Industry Identifier (MII) and Issuer Identification Number (IIN)

The very first digit is the Major Industry Identifier (MII), which signifies the economic sector of the issuing institution:

  • 1 and 2: Airlines and financial programs
  • 3: Travel and entertainment (American Express, Diners Club, JCB)
  • 4: Banking and financial institutions (Visa)
  • 5: Banking and financial institutions (Mastercard)
  • 6: Merchandising and banking (Discover, China UnionPay, Maestro)
  • 7: Petroleum and energy cards
  • 8: Telecommunications and healthcare
  • 9: National assignments and special testing

The first 6 to 8 digits form the Issuer Identification Number (IIN), historically known as the Bank Identification Number (BIN). This prefix identifies the network, the issuing bank (such as Chase, Citibank, or Barclays), card tier, and country of issue.

2. Individual account number

The intermediate sequence (following the IIN up to the penultimate digit) identifies the unique customer account. Issuers use this variable-length sequence to allocate millions of customer accounts.

3. Luhn check digit

The final digit is the check digit. It is explicitly calculated so that the entire number satisfies the Luhn Mod 10 formula.

Card network identification matrix

Each major card network specifies its own prefix patterns, expected digit lengths, and security code (CVV/CVC) formats:

Network BrandIIN / BIN PrefixesValid LengthsCVV LengthFormatting Layout
Visa416 (rarely 13 or 19)3 digits4-4-4-4
Mastercard51–55, 2221–2720163 digits4-4-4-4
American Express34, 37154 digits (front)4-6-5
Discover6011, 622126–622925, 644–649, 6516 (or 19)3 digits4-4-4-4
JCB3528–358916 to 193 digits4-4-4-4
Diners Club300–305, 36, 3814 (or 16)3 digits4-6-4
UnionPay6216 to 193 digits4-4-4-4
Maestro50, 56–58, 612 to 193 digits4-4-4-4

Mathematical validation vs payment authorization

It is essential to understand the difference between algorithmic validation and live payment authorization:

  • Offline mathematical validation: The Luhn algorithm verifies that a number follows legitimate formatting rules and contains no typos. It does not verify whether the card exists, whether it is currently active, or whether the account possesses available credit limit.
  • Online bank authorization: When a customer submits a purchase, the payment gateway sends an encrypted request to the acquiring bank, the card network (such as Visa or Mastercard), and the issuing bank. The issuing bank confirms that the card is active, verifies the CVV and expiration date, checks fraud scores, and ensures sufficient funds.
  • Keystroke error prevention: Implementing client-side Luhn checks in e-commerce checkout forms prevents customers from submitting mistyped numbers. This cuts unnecessary gateway API calls and decreases abandoned checkouts caused by minor typing errors.

Frequently asked questions

Does passing the Luhn algorithm mean the card is real and has available funds?
No. Passing the Luhn check only proves that the sequence of digits is mathematically valid according to the Mod 10 checksum. It does not verify whether the card is tied to an active bank account, has available funds, or has not been reported lost or stolen. Only a live authorization request through a payment gateway can confirm account validity.
What types of user input errors does the Luhn algorithm catch?
The Luhn algorithm catches 100% of single-digit substitution errors (such as typing 5 instead of 8) and almost all adjacent digit transposition errors (such as typing 47 instead of 74, except for 09 vs 90). It does not detect two-digit errors that accidentally compensate for one another.
Why does American Express have 15 digits instead of 16?
Card lengths are determined by network specifications under ISO/IEC 7812. American Express uses a 15-digit structure partitioned in 4-6-5 format with a 4-digit security code (CID) on the front of the card. In contrast, Visa, Mastercard, and Discover standardize on 16 digits partitioned in four blocks of four.
Can I validate multiple credit card numbers at once?
Yes. Switch the calculator to Batch Validator mode to paste multiple card numbers simultaneously. The tool will parse, clean, and validate each number, reporting brand identification, length compliance, Luhn checksum status, and exportable CSV or JSON summaries.
Is it safe to paste real credit card numbers into this online tool?
All calculations in this tool run entirely client-side in your web browser using JavaScript. No card numbers or personal information are ever transmitted to our server, stored in a database, or logged. For production payment processing, however, applications should always follow PCI-DSS security guidelines and tokenize card details.
How can I calculate loan payments and interest rates for credit card balances?
To evaluate debt repayment timelines and compare interest compounding across card balances, use our credit card payoff calculator, analyze daily interest charges with our credit card interest calculator, or model installment terms with our credit card payment calculator.

Resources and references

The formulas and methods in this calculator were checked against these independent sources.