Skip to content
2xKit

Credit Card Number Validator

Check if a card number passes the Luhn checksum and identify its network.

Formula v1.0.0GlobalMethodologyReport an issuecredit-card-validator-v1
How this is calculated
Luhn algorithm: double every second digit from the right, sum all digits, valid if total is a multiple of 10

Assumptions used in this calculation

  • Format check only: This only checks the Luhn checksum and prefix, it does not verify the card is real, active, or has funds.

About this calculator

Whether you're building a checkout form, debugging a payment integration, or just double-checking a number you typed, it helps to verify a card number is structurally valid before assuming it's a real error elsewhere. This validator takes a card number, strips spaces, and runs the Luhn (mod 10) algorithm, doubling every second digit from the right, summing all digits, and checking whether the total is a multiple of ten, while also matching the leading digits against known card network ranges (Visa, Mastercard, Amex and others) to identify the likely issuer. Performing the Luhn check by hand means carefully doubling alternating digits, correcting for double-digit results, and summing everything correctly, small arithmetic slips are common. The calculator runs the full check instantly and reports both the pass/fail result and the detected network, useful for testing forms with sample numbers or catching typos in a manually entered card number.

Worked example

A sample Visa test number

Result: Valid, Visa

Was this helpful?

Frequently asked questions