Luhn Algorithm Check: Validate Any Number Step by Step

Our Cards

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

test luhn algorithm

giftcardimage

Where to Use?

Redeem your gift cards at any of our Merchants

How to Test a Luhn Algorithm Implementation

Where to Buy?

You can purchase a gift card from any of these locations

Luhn Algorithm Test Numbers Guide

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

What a Luhn check does

A Luhn check (also called the mod 10 check) is a checksum test that catches typing mistakes in long numbers. You double every second digit starting from the right, sum all the digits, and divide the total by 10. If the remainder is 0, the number passes. If not, at least one digit is wrong or out of place.

The test says nothing about whether a card is real, active, or funded. It only confirms that the digits are internally consistent, so treat a pass as proof of formatting, not of validity.

Run the check step by step

  1. Strip spaces, dashes, and other separators so only digits remain.
  2. Start at the rightmost digit and move left, doubling every second digit (the second, fourth, sixth from the right).
  3. If a doubled value is greater than 9, subtract 9 from it.
  4. Add every resulting digit to a running total.
  5. Divide the total by 10 and look at the remainder.
  6. Accept the number when the remainder is 0, and reject it otherwise.

Worked example

Test the sequence 79927398713. Reading from the right, the digits in doubled positions are 1, 8, 3, 2, 9 and the digits in single positions are 3, 7, 9, 7, 7. The doubled values become 2, 16, 6, 4, 18, and after subtracting 9 where needed you get 2, 7, 6, 4, 9. The full sum is 3 + 2 + 7 + 7 + 9 + 6 + 7 + 4 + 9 + 9 + 7 = 70. Since 70 divides by 10 with no remainder, the number passes.

Find the missing check digit

  1. Remove the final digit, which is the check digit.
  2. Run the doubling and summing steps on the remaining digits.
  3. Double the result and subtract it from 10, then take the result mod 10.
  4. Place that digit at the end and re-run the full check to confirm a zero remainder.

Errors the algorithm misses

Luhn catches every single-digit error and most swaps of two adjacent digits. It does not catch a swap of 09 with 90, and it cannot detect two errors that cancel each other in the sum. A passing number can still be mistyped in ways the checksum hides, so verify the number against its source when accuracy matters.

Where the check is used

The same mod 10 formula appears in payment card numbers, IMEI codes on phones, the National Provider Identifier used in US healthcare billing, and many loyalty and account numbers. The formula is public, documented in ISO/IEC 7812-1, and simple enough to implement in a few lines of code or on paper.

Contact Us

Latest

Latest

new joker trailer url

Find the official new Joker trailer URL quickly: how to spot the real studio upload, what playback specs to expect, and how to skip mirror pages.

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