# Card Number Validator

Check whether a payment card number is well formed: the validator runs the Luhn checksum, recognises the card brand from its first digits, such as Visa, Mastercard, American Express, Discover, JCB, UnionPay, Diners Club, Maestro and Mir, and checks the length for that brand. Ideal for testing checkout forms with test card numbers. Numbers are never stored and the result shows them masked.

## Frequently asked questions

### What does the validator check?

Three things: that the number has 8 to 19 digits, that it passes the Luhn checksum every card number carries, and that its length fits the brand that its first digits identify. It does not contact any bank or card network.

### Does a valid result mean the card works?

No. A valid result only means the number is well formed. It says nothing about whether the card exists, is active, has funds or belongs to the person using it. Only a payment provider can authorise a card.

### What is the Luhn algorithm?

A checksum devised by the IBM researcher Hans Peter Luhn in the 1950s and used by almost all payment cards. Starting from the right, every second digit is doubled, 9 is subtracted from results above 9, and all digits are added up. The total must end in 0. It catches every single wrong digit and most swapped neighbours.

### How is the card brand recognised?

From the issuer identification number at the start: 4 for Visa, 51 to 55 and 2221 to 2720 for Mastercard, 34 and 37 for American Express, 6011 and 65 for Discover, 3528 to 3589 for JCB, 62 for UnionPay, 2200 to 2204 for Mir, and so on. Co-branded and regional cards can deviate from these ranges.

### Is it safe to enter a card number here?

The number is checked for this one request, never stored or logged, and the result shows it masked with only the first six and last four digits. Still, there is no reason to enter a real card number: for testing, use the test numbers that payment providers publish.

### Which test numbers can I use?

Payment providers publish test numbers that pass the Luhn check, such as 4111 1111 1111 1111 or 4242 4242 4242 4242 for Visa, 5555 5555 5555 4444 for Mastercard and 3782 822463 10005 for American Express. They only work in test mode and are useful for checking form validation.

### Why is a number with the right checksum marked invalid?

Because its length does not fit its brand, for example a 15-digit number starting with 4, while Visa numbers have 13, 16 or 19 digits. The message names the brand so you can see which digit is missing or extra.

### Can I check several numbers at once?

Yes, up to 50 numbers, one per line. Spaces and dashes are ignored, so numbers can be pasted in the usual groups of four.

### Can I check the expiry date or CVC?

No. Expiry dates and security codes have no checksum, so they cannot be validated without the card issuer. Your payment provider checks them when it authorises a payment.

### Can I use this to validate numbers in my own form?

Use it to see what your form should accept and reject. In your code, the Luhn check is a few lines in any language, and payment providers' own form components already validate the number and brand for you.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
