Card Number Validation Techniques: Luhn, BIN and Length Checks

Our Cards

Choose from any of our gift cards to give to your loved ones

related article

giftcardimage

Where to Use?

Redeem your gift cards at any of our Merchants

related article

Where to Buy?

You can purchase a gift card from any of these locations

more on this topic

ABOUT US

about

What is ONYX GiftCards?

Onyx Gift Cards is a Grenadian company designed to introduce, market and manage gift cards systems in Grenada for retailers and corporations. We are enthusiastic about the effect and influence we will have on the local market. We intend to expand our systems regionally with a range of product offerings and services.

What is a Gift Card?

Gift cards are the preferred way of giving and receiving gifts. They carry a monetary value that can be redeemed for gifts at your favorite store.
Onyx GiftCards are “Open Gift Cards” which means that they can be redeemed at multiple merchant locations. They are standard credit card size, can fit into the average wallet and made of PVC plastic. Onyx GiftCards are Barcoded for security and safety for the consumer and bear a disclaimer at the back.
Onyx Giftcards can be bought with a branded Card backer which is black in colour and is designed to fit the card. There is an area to write a brief message to the recipient as well.

How it Works?

  • Buy an Onyx Gift Card at these local stores
  • Give your gift card to friends, family, co-workers, etc.
  • The recipient can shop at our select merchants nationwide
  • Your friends, family, co-workers, etc. will present their gift card at checkout to pay for your item(s)
  • They will walk away happy with the best gift ever...the gift of Choice

Why ONYX GiftCards?

  • Save TIME. No need to run around looking for the perfect gift
  • Redeem from a variety of business island-wide. We will continue adding businesses as fast as ONYX grows.
  • ONYX Gift Cards do not expire
  • Cards are valued at convinient amounts to meet every need and occasion

Card number validation uses four layered checks: strip non-digit characters, confirm the length expected for the detected brand, match the leading digits against the issuer identification number (IIN, also called BIN) range, and run the Luhn checksum. Together these catch typos and malformed input before a request ever reaches an acquirer. None of them prove a card exists, is active, or has funds available.

How does the Luhn algorithm validate a card number?

The Luhn (modulus 10) check reads the digits from right to left, doubling every second digit and subtracting 9 from any result above 9. It sums all digits and requires the total to be divisible by 10. The check catches every single-digit error and most adjacent transpositions, which is why it is the standard front-line filter.

A passed Luhn check is weak evidence on its own: roughly one in ten random digit strings satisfies it. Treat it as a typo filter, not a validity signal.

Why check length and BIN range before the checksum?

Card brands define fixed or bounded lengths, typically 13 to 19 digits, and reserve leading digit ranges for issuers. Comparing the first six to eight digits against a BIN table tells you the likely brand, country, and card type before any network call. This ordering matters because length and prefix errors are cheaper to detect than a failed authorization.

What is the difference between format validation and authorization?

Format validation is deterministic arithmetic on a string; authorization is a live decision by the issuer. Only an authorization request, or a zero-amount verification, can confirm the account is open and the CVV and address data match. A number that passes every local check can still be closed, blocked, or fraudulent.

How should card numbers be handled in code and logs?

PCI DSS requires protecting cardholder data at rest and in transit, and the CVV must never be stored after authorization. Mask all but the last four digits in interfaces, keep full numbers out of application logs, and pass raw values only to a tokenizing payment processor. Client-side validation should mirror server-side rules, never replace them.

What can validation not tell you?

Local checks cannot detect a stolen number, a dormant account, or an issuer block, and repeated validation attempts can resemble enumeration attacks. Rate-limit attempts, monitor for BIN cycling patterns, and route every real transaction through the processor's own verification. Validation reduces noise; it does not establish trust.

Contact Us

Latest

Latest

How to Sell CVV

Learn how to safely sell CVV cards and protect yourself from legal consequences.

Ultimate Guide to Safely Buying CVV

Discover how to safely purchase CVV numbers without risking your financial security. This comprehensive guide provides expert advice and tips for navigating the risks and pitfalls.

Read our complete guide: Should You Buy CVV From a Card Shop? The Honest Buyer's Guide