Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The Luhn algorithm—also called the Mod 10 check—tests whether a payment-card number passes a checksum. Starting with the digit immediately left of the final digit, double every other digit moving left; subtract 9 from any doubled value greater than 9; then add those adjusted values to the untouched digits. A total divisible by 10 passes. That result shows only checksum plausibility, not whether the account was issued, is active, or can authorize a payment.

How the Luhn or Mod 10 check works

The rightmost digit is the check digit. Leave it unchanged and begin the alternating doubling pattern with the digit immediately to its left. Continue moving right to left: double the next digit, leave the one after it unchanged, and repeat. When a doubled value is greater than 9, subtract 9. Add the resulting values, including the unchanged digits and check digit. If the sum is divisible by 10, the number passes the Luhn checksum.

PCI Security Standards Council FAQ 1137 describes Luhn, or Modulus 10, as the algorithm most often used to validate Primary Account Numbers (PAN). Read the PCI SSC explanation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Worked example

Consider the sample digit string 79927398713. This is an arithmetic illustration of the checksum, not a claim that the string is an issued or usable payment card.

#1 Best Overall
Square Terminal - Credit Card Machine to Accept All Payments | Mobile POS
  • With Square Terminal, you can ring up sales, accept payments, and print receipts, all with one device. Use it at the counter or ring up customers anywhere in your store.
  • Accept all major credit and debit cards and pay one low rate with no hidden fees and no long-term contracts.
  • Process chip cards in just two seconds.
  • Get your money as soon as the next business day.
  • Use it cordlessly with the built-in battery, designed to last all day.
  1. Keep the final digit, 3, unchanged. Moving left, double alternating digits: 1→2, 7→7, 8→16, 9→9, 3→6, 7→7, 2→4, 9→9, 9→18, 7→7.
  2. Reduce doubled values over 9 by subtracting 9: 16 becomes 7 and 18 becomes 9.
  3. Add the transformed values and untouched digits: 7 + 9 + 4 + 7 + 6 + 7 + 9 + 7 + 2 + 1 + 3 = 62.
  4. Divide the total by 10. Since 62 leaves a remainder of 2, this example does not pass the checksum.

What a passing result does—and does not—mean

A pass means the digits satisfy the checksum formula. It can help catch some mistyped or malformed input before a payment request is sent, but it does not establish that the number was issued, that an account is active, that the person entering it owns the account, that funds are available, or that a transaction will be authorized. PCI SSC explicitly distinguishes a number that is possible under the formula from one that has actually been issued and is active.

Using the check in an application

Separate checksum from formatting and length rules

Process the actual digits consistently. If the input field permits spaces or hyphens for readability, remove only the formatting characters your application explicitly allows before applying the checksum; reject unexpected characters rather than silently treating them as digits. Apply the relevant product, issuer, or payment-provider length and format rules separately. CyberSource documents account numbers up to 19 digits including the check digit, but that does not mean every payment product uses every length in that range.

Rank #2
Square Reader for magstripe (USB-C)
  • Get your money as soon as the next business day.
  • Get set up quickly with no long-term commitments. Download the Square Point of Sale app for free, create an account, and start taking payments anywhere.
  • Run your business all in one place with the free Square Point of Sale app. Track your sales, manage inventory, accept tips, send receipts digitally, and more.
  • Works with Apple devices with a Lightning connector.

CyberSource describes checking a user-entered account number before sending it for authorization. The check is an input-quality step, not a replacement for the processor or issuer’s authorization flow. See its check-digit guidance.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Present the result accurately

Use wording such as “passes the Luhn checksum” or “checksum format looks plausible.” Avoid labels such as “valid card” or “active card,” which imply facts the calculation cannot verify. A passing checksum can be one early validation step, while authorization determines whether a transaction can proceed.

Rank #3
MSR90 USB Swipe Magnetic Credit Card Reader 3 Tracks Mini Smart Card Reader MSR605 MSR606 Deftun
  • MSR90 is a USB emulation keyboard interface that not need any driver or software,USB simply plug and play
  • Reads up to 3 tracks of information,can reads ISO7811, AAMVA, CA DMV and most other card data formats
  • Threaded inserts for mounting. LED indicator, green light is on when connecting,green light blinks when cards swiped
  • Bi-directional swipe reading, superior reading of high jitter, scratched, and worn magstripe cards, reliable for over 1,000,000 card swipes
  • Configuration software makes configuration changes easy,works with: Windows OS and Mac OS
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Checksum validation is not payment-data security

Luhn is not a security control and does not protect stored or transmitted card data. PCI DSS is a baseline of technical and operational requirements intended to protect payment account data. PCI SSC identifies its intended audience as entities that store, process, or transmit cardholder data, or can affect the security of cardholder-data environments. Consult the PCI DSS overview for the standard’s scope.

Luhn terminology also appears in payment tokenization documentation, including J.P. Morgan Payments’ tokenization materials; that context does not change what a checksum pass proves.

Quick Recap

Bestseller No. 1
Square Terminal - Credit Card Machine to Accept All Payments | Mobile POS
Square Terminal - Credit Card Machine to Accept All Payments | Mobile POS
Process chip cards in just two seconds.; Get your money as soon as the next business day.; Use it cordlessly with the built-in battery, designed to last all day.
$298.99
Bestseller No. 2
Square Reader for magstripe (USB-C)
Square Reader for magstripe (USB-C)
Get your money as soon as the next business day.; Works with Apple devices with a Lightning connector.
$9.88
Bestseller No. 3
MSR90 USB Swipe Magnetic Credit Card Reader 3 Tracks Mini Smart Card Reader MSR605 MSR606 Deftun
MSR90 USB Swipe Magnetic Credit Card Reader 3 Tracks Mini Smart Card Reader MSR605 MSR606 Deftun
Configuration software makes configuration changes easy,works with: Windows OS and Mac OS
$18.99
Bestseller No. 4
ETEKJOY USB 3-Track Magnetic Stripe Card Reader POS Credit Card Reader Swiper MagStripe Swipe Card Reader ET-MSR90
ETEKJOY USB 3-Track Magnetic Stripe Card Reader POS Credit Card Reader Swiper MagStripe Swipe Card Reader ET-MSR90
Perfect for POS, Banking, Loyalty, Access Control, ID verification and other applications.
$18.50
SaleBestseller No. 5
Square Reader for magstripe (with Lightning connector)
Square Reader for magstripe (with Lightning connector)
Pay one transparent rate per swipe for Visa, Mastercard, Discover and American Express.
$9.40
Best Value
Sale
Square Reader for magstripe (with Lightning connector)
  • Pay one transparent rate per swipe for Visa, Mastercard, Discover and American Express.
  • Works in conjunction with most downloadable Square point-of-sale apps on your device. Customers can pay, tip and sign directly on your device. Track payments in cash, gift cards and more. Also lets you send receipts via e-mail or text message, makes it easy to apply discounts, keeps a data and sales history log and more.
  • Accepts magstripe credit card payments, including those from Visa, Mastercard, Discover and American Express (fees apply).
  • App sends deposits to your bank account within 1 to 2 business days, or enjoy instant deposits (fees apply).
Rank #4
ETEKJOY USB 3-Track Magnetic Stripe Card Reader POS Credit Card Reader Swiper MagStripe Swipe Card Reader ET-MSR90
  • USB interface, keyboard emulation, no need to install software to read, configuration software for changing settings available.
  • Read data from all 3 tracks, high and low coercivity cards, ISO7811, AAMVA, CA DMV and most magnetic card data formats.
  • Work on Windows, Mac and other USB capable systems. Work with TXT, notepad, Word, Excel, POS systems and son on.
  • Compact size, with 145cm USB cord, two 3mm-diameter screw holes for fixing at the bottom, a LED indicator light
  • Perfect for POS, Banking, Loyalty, Access Control, ID verification and other applications.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.