Data CheckerData verification

Credit card number validator

The last digit of a card number is a Luhn check digit, recomputed from the others. That is what lets a form reject a mistyped entry before it ever reaches the bank — and it is all this check proves.

Free Computed in your browserNo credit used

Use test numbers only. The maths stays in your browser, but a real card has no business in a public form field.

How the check works

  1. 1

    The number is cleaned and measured

    Spaces and dashes are stripped. A PAN is 12 to 19 digits depending on the network: 16 for Visa and Mastercard, 15 for American Express, 14 for Diners.

  2. 2

    The network is derived from the IIN

    The leading digits identify the issuer: 4 for Visa, 51-55 and 2221-2720 for Mastercard, 34 and 37 for American Express. The expected length is checked at the same time.

  3. 3

    The Luhn check digit is recomputed

    Every second digit is doubled from the right, two-digit results are reduced, and the total must be a multiple of 10.

What the check does not say

It does not say the card exists. A randomly drawn number whose check digit happens to add up passes exactly like a real one. Only the acquiring network — through an authorisation or a zero-amount check — knows whether a card is issued, active and funded.

It says nothing about the expiry date or the security code either, since no arithmetic ties them to the number.

Use test numbers here only

The maths does run in your browser and nothing is transmitted. But pasting a real card into a public page's field stays a bad habit: browser history, form managers, screenshots. The three examples offered are the test numbers published by payment providers.

The site's test data generator produces more numbers of the same family for your fixtures.

Frequently asked questions

What is the Luhn check digit for on a card?

To catch typing mistakes before bothering the banking network. It detects every single-digit error and almost every transposition of two adjacent digits — the two most common typos. A form that checks it avoids a round trip and an error message the customer cannot interpret.

Is a number that passes the check a valid card?

No. The Luhn check consults no database: it verifies arithmetic consistency. Roughly one in ten randomly drawn numbers satisfies it. A card's real validity is established only by an authorisation request to the network.

What do the first six digits mean?

That is the IIN (Issuer Identification Number), also called the BIN. It identifies the issuing institution and lets you derive the network, the card type (debit, credit, prepaid) and sometimes the country. Complete BIN tables are commercial products; this tool sticks to network ranges, which are public.

Why does my Amex have only 15 digits?

American Express uses a 15-digit format, grouped 4-6-5, with a 4-digit code printed on the front. That is fully compliant with ISO/IEC 7812: PAN length was never fixed at 16, that is simply the most common format.

The same check over API

This tool runs in your browser. To run the same check from your code, in bulk or server-side, the API answers in JSON.

Read the documentation

Related tools

All tools
Credit card number validator (Luhn check, network) | Data Checker