2ClickKit

Credit & Debit Card Brand Detector

Files Never Leave Your Device

Identify card brands, schemes, formatting rules, and CVV positions from card prefixes and length constraints. 100% client-side execution.

Payment Card Brand & Scheme Detector

Real-time identification of Visa, Mastercard, American Express, Discover, JCB, UnionPay, RuPay, Maestro, Diners Club, and Mir from prefix rules, length constraints, and Luhn Modulo 10 verification.

Test Across 10 Payment Networks
16 digits
Visa
4111 2222 3333 4444
CARDHOLDERALEX MORGAN
EXPIRES10/28
CVV789
Scheme Detection DiagnosticsMatched Scheme
Brand NetworkVisaPrefix: 4
Length Validation
Valid Length
Expected: 13, 16, 19 digits (Current: 16)
Security Code (CVV/CID)3 Digits (back)CVV2 (Card Verification Value 2)
Luhn Checksum (Mod 10)
Failed Luhn Checksum
ISO/IEC 7812-1 standard check
Scheme Notes: The world's largest electronic payment card network, governed by Visa Inc.

ISO 7812 Card Scheme Rules & Spacing Matrix

Card SchemeIIN / Prefix RangeStandard LengthsSpacing FormatSecurity CodeChecksum Rule
Visa413, 16, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10
Mastercard51-55 or 2221-2720 (2-Series)16 digits4-4-4-43 digits (back)Luhn Mod-10
American Express34 or 3715 digits4-6-54 digits (front)Luhn Mod-10
Discover6011, 622126-622925, 644-649, 6516, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10
JCB3528-358916, 17, 18, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10
China UnionPay62 or 8116, 17, 18, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10
RuPay508, 60, 6521, 6522, 81, 82, 353816 digits4-4-4-43 digits (back)Luhn Mod-10
Maestro50, 56-58, 60-6912, 13, 14, 15, 16, 17, 18, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10
Diners Club300-305, 3095, 36, 38-3914, 16 digits4-6-43 digits (back)Luhn Mod-10
Mir2200-220416, 17, 18, 19 digits4-4-4-4-33 digits (back)Luhn Mod-10

Technical Architecture: Payment Card Schemes & Prefix Detection Rules

In modern electronic commerce checkout experiences, frictionless checkout flows depend on instantaneous payment card brand detection. When a customer enters account numbers into a web or mobile checkout field, the user interface should immediately adapt: displaying the authentic brand emblem, enforcing the exact digit length, applying brand-specific grouping spaces (such as 4-6-5 for American Express or 4-4-4-4 for Visa and Mastercard), and toggling CVV helper hints between 3-digit reverse codes and 4-digit front codes.

This real-time responsiveness is powered by client-side regex pattern evaluation matching ISO/IEC 7812 specification guidelines. Because this processing happens locally in browser memory, checkout engines prevent unnecessary payment gateway API transactions for invalid inputs and eliminate card abandonment.

Comprehensive Comparison of Global Card Scheme Standards

Each global and domestic payment network maintains rigid structural specifications regarding Primary Account Number (PAN) prefixes, allowable length variations, and cryptographic verification values:

Card Scheme Prefix Rules (Regex Pattern) Allowable PAN Lengths Visual Spacing Security Code Name & Length
Visa ^4 13, 16, 19 digits 4-4-4-4 (or 4-4-4-4-3) CVV2 (3 digits, back)
Mastercard ^(5[1-5]|2[2-7]) 16 digits 4-4-4-4 CVC2 (3 digits, back)
American Express ^3[47] 15 digits 4-6-5 CID (4 digits, front)
Discover ^(6011|65|64[4-9]|622) 16, 19 digits 4-4-4-4 (or 4-4-4-4-3) CID (3 digits, back)
JCB ^35(2[89]|[3-8][0-9]) 16, 17, 18, 19 digits 4-4-4-4 CAV2 (3 digits, back)
China UnionPay ^(62|81) 16, 17, 18, 19 digits 4-4-4-4 CVN2 (3 digits, back)
RuPay ^(508|60|6521|6522|81|82|3538) 16 digits 4-4-4-4 CVD (3 digits, back)
Diners Club ^(30[0-5]|36|38) 14, 16 digits 4-6-4 or 4-4-4-4 CVV2 (3 digits, back)
Maestro ^(50|5[6-9]|6) 12 through 19 digits Variable (4-4-4-4 standard) CVC2 (3 digits, optional)
Mir ^220[0-4] 16 through 19 digits 4-4-4-4 MirAccept (3 digits, back)

Deep-Dive into Major Card Brand Specifications

1. Visa (Prefix 4)

Visa is the world's most ubiquitous payment network. Under ISO 7812, all Visa card numbers begin with the single digit 4 (which designates Major Industry Identifier 4: Banking and Financial). While legacy Visa cards historically supported 13 digits, modern Visa cards universally feature 16 digits, with certain specialized contactless or transit cards supporting up to 19 digits. Visa card numbers are visually formatted in four equal blocks of 4 digits (4-4-4-4). The Card Verification Value 2 (CVV2) is a 3-digit code printed in reverse italics on the signature panel.

2. Mastercard (Prefixes 51-55 & 2221-2720)

Mastercard accounts historically began with prefixes in the 51 through 55 range. In 2017, Mastercard introduced the 2-Series BIN range spanning from 222100 to 272099. The 2-series behaves identically to 5-series cards in every transaction processing rule: standard 16-digit length, 4-4-4-4 grouping, and a 3-digit Card Validation Code 2 (CVC2) on the reverse side. Any merchant gateway that does not recognize 2-series prefixes risks erroneously declining legitimate Mastercard cardholders.

3. American Express (Prefixes 34 & 37)

American Express operates as a closed-loop and partner payment network. Amex Primary Account Numbers strictly begin with either 34 or 37 and contain exactly 15 digits. The numbers are spaced into three distinct blocks: four digits, six digits, and five digits (4-6-5). Additionally, American Express is the only major network that places its security code—the 4-digit Card Identification Number (CID)—on the front of the card, printed directly above the right-hand portion of the account number.

4. Discover & Discover Global Network

Discover cards begin with 6011, 65, the range 644-649, or the extended range 622126-622925 (co-assigned with China UnionPay). Standard Discover cards are 16 digits in length and use 4-4-4-4 spacing. The Discover security code is a 3-digit CID located on the back signature strip. Discover operates reciprocal merchant acceptance agreements with JCB, UnionPay, and Diners Club International under the Discover Global Network banner.

5. JCB (Prefixes 3528-3589)

JCB (formerly Japan Credit Bureau) cards begin with digits 3528 through 3589. JCB cards generally span 16 digits, though the specification allows 16 to 19 digits. Spacing follows the 4-4-4-4 format, and the security code is designated as Card Authentication Value 2 (CAV2), spanning 3 digits on the reverse.

6. RuPay (NPCI India)

Established by the National Payments Corporation of India to reduce dependency on foreign card schemes, RuPay cards use prefixes including 508, 60, 6521, and 6522, as well as 81 and 82. Most RuPay cards are 16 digits formatted in 4-4-4-4 grouping, utilizing a 3-digit Card Verification Digits (CVD) code. RuPay cards configured for international use feature a dual logo with Discover or JCB.

Client-Side Implementation: React / TypeScript Hook

Below is a clean, dependency-free React hook pattern for embedding real-time card brand detection into modern frontend forms:

// useCardBrand.ts - Lightweight Client-Side Card Scheme Detector
import { useMemo } from 'react';

export interface CardScheme {
  brand: 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'unknown';
  displayName: string;
  cvvLength: number;
  maxLength: number;
  spacing: number[];
}

export function useCardBrand(pan: string): CardScheme {
  return useMemo(() => {
    const clean = pan.replace(/\D/g, '');

    if (/^4/.test(clean)) {
      return { brand: 'visa', displayName: 'Visa', cvvLength: 3, maxLength: 16, spacing: [4, 4, 4, 4] };
    }
    if (/^(5[1-5]|2[2-7])/.test(clean)) {
      return { brand: 'mastercard', displayName: 'Mastercard', cvvLength: 3, maxLength: 16, spacing: [4, 4, 4, 4] };
    }
    if (/^3[47]/.test(clean)) {
      return { brand: 'amex', displayName: 'American Express', cvvLength: 4, maxLength: 15, spacing: [4, 6, 5] };
    }
    if (/^(6011|65|64[4-9])/.test(clean)) {
      return { brand: 'discover', displayName: 'Discover', cvvLength: 3, maxLength: 16, spacing: [4, 4, 4, 4] };
    }
    if (/^35(2[89]|[3-8][0-9])/.test(clean)) {
      return { brand: 'jcb', displayName: 'JCB', cvvLength: 3, maxLength: 16, spacing: [4, 4, 4, 4] };
    }

    return { brand: 'unknown', displayName: 'Card', cvvLength: 3, maxLength: 19, spacing: [4, 4, 4, 4] };
  }, [pan]);
}

Luhn Modulo 10 Checksum Verification

In addition to prefix identification, valid payment card numbers must satisfy the Luhn algorithm (Modulo 10), defined in ISO/IEC 7812-1 Annex B. The algorithm verifies data integrity across manual keyboard entry:

  1. Starting from the rightmost check digit, moving leftward, double every second digit.
  2. If doubling results in a number greater than 9 (e.g., $7 \times 2 = 14$), sum the constituent digits ($1 + 4 = 5$) or subtract 9 ($14 - 9 = 5$).
  3. Sum all resulting values across the entire sequence.
  4. If the total modulo 10 equals zero (∑ mod 10 = 0), the card number is mathematically valid.

Security and Zero-Data Leakage Architecture

Because this tool executes 100% client-side inside the user's web browser, no account numbers, cardholder names, expiration dates, or CVV values are transmitted across external networks. Developers and QA engineers can test synthetic or masked PAN strings without violating PCI-DSS compliance mandates or exposing sensitive financial parameters to third-party analytic trackers.

How to Use Card Brand Detector

  1. Input Card Account Digits

    Enter any partial card prefix or complete card number into the Primary Account Number field.

  2. Analyze Prefix & Length Constraints

    The detector checks ISO 7812 prefix rules for Visa, Mastercard, Amex, Discover, JCB, UnionPay, RuPay, and Maestro.

  3. Inspect CVV Rules & Modulo 10 Checksum

    Review the required CVV/CID digit length, card placement (front vs back), and live Luhn checksum validation.

Authoritative Scheme Detection Example

Input PAN
378282246310005
Detected Scheme
American Express (15 Digits) | 4-6-5 Spacing | 4-Digit Front CID | Luhn Valid

Calculated instantly in 1 millisecond with zero server transmission.

Technical Specifications

  • Supported Inputs: Primary Account Numbers (PAN), Card Prefixes, IIN / BIN Blocks
  • Input Limit: Unlimited client-side evaluation
  • Processing Engine: 100% In-Browser (ISO/IEC 7812 Scheme Pattern Engine)
  • Content Uploads: None (Your files and text are processed locally on your device with zero uploads)

Privacy & Security Guarantee

Your card numbers and prefixes are processed entirely in your web browser's memory using native client-side web technologies. Unlike traditional cloud tools, your content is never uploaded to remote servers, stored on external disks, or analyzed by third parties.

2ClickKit In-Browser vs Traditional Cloud Tools

Feature 2ClickKit (In-Browser) Traditional Cloud Services
Data Privacy Files never leave your local device Uploaded to remote servers and third-party clouds
Processing Speed Instant local execution (0ms upload time) Constrained by internet upload & server processing queues
Account & Costs 100% Free with zero registration or paywalls Tiered subscriptions, limits, or forced sign-ups

Best Practices & Tips

  • In user checkout forms, update the brand icon on the input field dynamically after the user types the first 2 to 4 digits.
  • Remember that Diners Club cards can contain 14 digits (legacy international format) or 16 digits (Mastercard co-branded format).
  • Always pair brand prefix detection with client-side Luhn verification to catch 98%+ of human mistyping errors immediately.

Frequently Asked Questions

How do payment systems automatically detect a card brand?

Payment processing software and checkout gateways inspect the leading digits of the Primary Account Number (PAN), known as the Issuer Identification Number (IIN) or Bank Identification Number (BIN). Each card scheme network operates under strict prefix rules registered with the International Organization for Standardization (ISO/IEC 7812). For example, any PAN beginning with digit 4 is routed to Visa, while prefixes 51-55 and 2221-2720 route to Mastercard.

Why does American Express have 15 digits instead of 16?

American Express established its card architecture independently of the 16-digit structure popularized by bank credit cards. Amex uses a 15-digit format structured as 4-6-5: the first 2 digits (34 or 37) designate the network and currency; the next 4 digits represent the account type and issuing company; the next 8 digits represent the individual account; and the 15th digit is the Luhn Modulo 10 check digit.

What is the Mastercard 2-Series BIN range?

In 2017, Mastercard expanded its traditional 51-55 BIN range to include the 222100 through 272099 numeric range (referred to as 2-Series BINs). This addition provided millions of new account numbers for digital tokenization and fintech issuers. Merchants and point-of-sale terminals worldwide must support both 5-series and 2-series ranges to prevent transaction declines.

How does CVV/CVC length and positioning differ across card brands?

Most international card networks—including Visa (CVV2), Mastercard (CVC2), Discover (CID), JCB (CAV2), and RuPay (CVD)—utilize a 3-digit security code printed on the signature strip on the reverse side of the card. In contrast, American Express uses a 4-digit Card Identification Number (CID) printed in flat ink on the front face above the embossed account number.

What are the prefix rules for India's RuPay network?

The RuPay payment scheme, managed by the National Payments Corporation of India (NPCI), uses several registered IIN prefixes including 508, 60, 6521, 6522, 81, 82, and 3538. RuPay cards span domestic debit, Kisan credit cards, and international co-branded variants partnered with Discover and JCB.

What happens if a customer inputs an invalid length for their card brand?

Payment forms immediately highlight a length validation error before making a remote API call to payment processors like Stripe, Adyen, or Braintree. For example, if a user enters a 16-digit card starting with 37, the form rejects the input because American Express cards must strictly contain exactly 15 digits.

Can this tool verify whether a card has sufficient credit or is active?

No. This tool operates 100% client-side inside your browser and evaluates structural ISO/IEC 7812 prefix syntax and Luhn mathematics. Verifying account status, credit balance, or stolen card alerts requires an authorized network authorization request through an acquiring bank.

Is my card data kept secure while using this detector?

Yes, completely. 2ClickKit executes entirely in client-side JavaScript. Zero card numbers, keystrokes, or detection results are ever uploaded to any server or recorded in cloud databases, upholding PCI-DSS security principles.