deftools.io Security

Credit Card Validator

Validate credit card numbers with the Luhn algorithm, detect card brand, format, mask, and generate Luhn-valid test numbers.

Enter a card number
Luhn check + brand detection runs live as you type.
Luhn algorithm — step by step

Type a number to see the doubled digits, subtractions, and final checksum.

Test numbers (Luhn-valid) click to load

These are well-known sandbox numbers published by payment processors and card networks for testing. They are not real cards and cannot be charged.

Brand reference (IIN ranges & lengths)
Brand IIN / Prefix Length CVV

No network requests. The number is processed only in your browser's memory.

About this tool

Enter any card number and the tool runs the Luhn checksum live as you type, telling you whether the number is structurally valid and which card network it belongs to (Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro, MIR, and others). It also formats the number for readability and shows the doubled digits and running sum so you can see exactly how the Luhn check is computed.

Example: 4111111111111111 passes the Luhn check and is detected as a 16-digit Visa card. 378282246310005 is detected as a 15-digit American Express card (grouped 4-6-5, CVV is 4 digits).

The Test numbers panel lists well-known sandbox numbers published by payment processors for development and QA. They are Luhn-valid but cannot be charged. Use the mask toggle to hide all but the last four digits when sharing a screen or taking screenshots.

FAQ

Can this tool tell me if a card is real and can be charged?

No. The Luhn check only confirms the number is structurally valid (the checksum digit matches). It does not verify that the account exists, has funds, or is authorized. Only a payment processor connected to the card networks can do that.

What is the Luhn algorithm?

The Luhn algorithm, created by Hans Peter Luhn in 1954, adds a check digit to a number so that any single-digit error (and most adjacent-digit swaps) is caught. Starting from the rightmost digit, every second digit is doubled and, if the result exceeds 9, reduced by 9; if the total sum is divisible by 10 the number is valid.

Why does my card show as "unknown brand"?

The number passed the Luhn check but its Issuer Identification Number (the first digits) does not match any brand prefix the tool recognizes. New IIN ranges are issued regularly, so a brand-new or regional issuer may not be covered.

Are the test numbers safe to use in production?

They are published by processors specifically for sandbox and development use and will be declined by live payment systems. Never substitute them for a real card. They are useful only for testing forms, validation logic, and checkout flows.

Related security tools

Copied!