A Luhn check is a simple mathematical formula that validates the basic structure of a payment card number. Every virtual card number you get from a service like ours passes this check, which is the first step a merchant's checkout page takes to verify a card.
What Is a Luhn Check?
A Luhn check, also known as the Luhn algorithm or modulus 10 check, is a basic mathematical formula used to validate the format of identification numbers, most commonly payment card numbers. It is a quick, automated test that a card number is potentially valid before any other checks for funds or account status are performed. When you enter a card number at an online checkout, the payment form often runs this check in your browser in milliseconds. If the number fails the Luhn check, you will typically get an immediate error asking you to correct the card number, without the payment ever being sent to the card network. This makes it a first line of defense against simple typos and randomly generated fake numbers.
How the Luhn Check Works Step by Step
The algorithm follows a specific set of steps to produce a check digit, which is the last digit of your card number. Starting from the rightmost digit (the check digit itself), you move left, doubling the value of every second digit. If doubling a digit results in a number greater than 9, you add the two digits of that product together (or subtract 9). After processing all digits, you sum them up. A valid card number will have a total sum that is divisible by 10 (i.e., the sum modulo 10 equals 0). For example, consider a simplified sequence. The process is designed to catch the most common data entry error, which is a single mistyped digit. It does not verify that the card is active, has funds, or belongs to you; it only confirms the number is structured like a real payment card.
Why the Check Digit Exists
The final digit of your card number is not random; it is calculated by the Luhn formula based on all the preceding digits. This allows the formula to work as described. When a card issuer generates a new card number, they calculate the appropriate check digit to append so the full number passes the test. This is why all legitimate virtual card numbers, including those for our Midnight and Gold programs, are issued with a correct check digit.
A Luhn Check Example During an Online Purchase
Imagine you are purchasing a software subscription like Adobe Creative Cloud or a plan on Microsoft 365. You go to the checkout page and type in your virtual card number. As soon as you tab out of the card number field, a small script on the merchant's website runs the Luhn check. If you accidentally transpose two digits (for instance, typing '21' instead of '12'), the algorithm will likely catch it and display a message such as "Please check your card number." This saves time and prevents a failed payment attempt that would result in a decline and potentially a decline fee. Only after this basic format check passes does the site proceed to ask for your CVV, expiry date, and billing address, and then send the payment for authorization.
Why the Luhn Check Matters for Your Prepaid Virtual Card
For users of prepaid virtual cards, the Luhn check is a background guarantee of quality. It means the card number you receive is a formally valid payment instrument from the moment it is issued. You will never encounter a "invalid card number" error due to a flaw in the number generation itself. This reliability is crucial when you need a card quickly for time-sensitive payments, such as securing a Booking.com reservation or activating a Google Ads account. Since our cards are designed for direct use after issuing and loading, passing the Luhn check is the foundational step. It also means that when a payment is declined, you can rule out a simple number formatting issue and look to other causes, such as the merchant not accepting prepaid cards or a billing address mismatch.
Common Misunderstandings About the Luhn Check
Several misconceptions surround this algorithm. First, passing a Luhn check does not mean a card is legitimate, has funds, or is authorized for a purchase; it only means the number sequence is mathematically plausible. Second, it does not provide any security against fraud or theft; it is not an encryption method. A thief with a valid card number can pass the Luhn check easily. Third, it is not a check performed by the card network or issuer during the authorization process; it is a preliminary step done by the merchant's software. Finally, some people believe it can identify the card network (like Visa or Mastercard), but while the first digits (the BIN) identify the issuer and program, the Luhn formula works the same across all major networks.
What the Luhn Check Does Not Do
It is critical to understand the limits of this check. It does not verify that the card is open, unfrozen, and has sufficient balance. It does not check the CVV or expiry date. It does not perform an Address Verification Service (AVS) match. It does not trigger a 3-D Secure step. All of those are separate, subsequent checks in the payment flow. A card can pass the Luhn check and still be declined for dozens of other reasons detailed in our declines guide.
Related Terms for Virtual Card Payments
Understanding the Luhn check fits into a broader knowledge of how card payments work. The Primary Account Number (PAN) is the full card number that undergoes the check. The first six digits of the PAN are the Bank Identification Number (BIN), which routes the transaction. After the number passes the Luhn check, the merchant seeks an authorization from the issuer. For prepaid cards like ours, this checks the card's balance and status. If you are paying in a foreign currency, a separate FX markup may apply depending on your card program. All these concepts come together when you use a virtual card to pay for services like AWS or Spotify.
When you issue a virtual card with us, you can be confident its number is mathematically valid and ready for online checkouts. For more on ensuring smooth payments, see our guides on how to complete 3-D Secure and how to fix billing address errors.
Questions people ask
Does a passed Luhn check mean my virtual card payment will be approved?
No. A passed Luhn check only means the card number format is valid. The payment must still pass checks for sufficient balance, correct CVV and expiry, billing address, merchant acceptance, and any 3-D Secure step.
Can I calculate the Luhn check digit myself?
Yes, the algorithm is public and simple enough to perform manually or with an online calculator. However, as a card user, you never need to; your card issuer provides the full valid number.
Why did my virtual card number fail the Luhn check at checkout?
This is extremely rare for a properly issued card. It likely indicates you made a typo when entering the number. Double-check the digits you copied from your dashboard, ensuring no digits are missing or transposed.
Is the Luhn check used for anything besides credit cards?
Yes, the algorithm is used to validate various identification numbers, such as IMEI numbers on mobile phones, some national ID numbers, and Social Insurance Numbers in Canada.
Do all online stores perform a Luhn check?
Nearly all professional payment forms do, as it is a basic best practice to catch input errors early. If a site does not perform it, you might not discover a typo until the payment is declined by the network.