Luhn Validation Test Case
A ready-to-run Luhn validation test case kit for QA engineers and developers verifying Mod 10 checksum logic โ pass, fail, and boundary cases included.

The quickest Luhn algorithm example is a card number such as 79927398713. Double every second digit starting from the right, subtract 9 from any result above 9, then add all eleven digits together. If the total is a multiple of 10 the number passes the check. That is the whole method: a mod-10 checksum, not a security feature.
Working through 79927398713: the check digit 3 stays as is, the 1 becomes 2, the 8 becomes 16 and then 7, the 3 becomes 6, the 2 becomes 4, and the 9 becomes 18 and then 9. The digits are now 7, 9, 9, 4, 7, 6, 9, 7, 7, 2, 3, and the total is 70. Because 70 divides evenly by 10, the number is Luhn-valid. The same routine scales to any length and any issuing network, which is why it shows up wherever a cheap, dependency-free sanity check is useful.
The technique is public, unlicensed, and free to implement in any language, with no purchase or account required. Implementations are short enough to verify by hand, and any correct version will produce identical results, so you can test your own code against a known example at any time.
It proves only that the digits are internally consistent, meaning no single digit was mistyped and no two neighbours were swapped. It says nothing about whether the number is real, active, or belongs to anyone.
A single wrong digit would otherwise reach the payment network and fail there. The check digit catches most typing errors at the point of entry, which saves time and cuts down on avoidable declines.
Yes. There are ten valid endings for any prefix, so invented numbers pass roughly one time in ten. The checksum filters typos, not fiction.
A ready-to-run Luhn validation test case kit for QA engineers and developers verifying Mod 10 checksum logic โ pass, fail, and boundary cases included.
Improve your card verification with our Luhn Check Algorithm Test.
A plain-English guide to the Luhn algorithm example test: how the checksum works, a worked example, and what a pass or fail actually tells you.