Test Credit Card Number Generator
Generate Luhn-valid test card numbers for development.
About the Test Credit Card Number Generator
Generates fake but Luhn-valid card numbers for testing payment forms in development. These are NOT real cards and cannot be used for any transaction.
How to use
Pick a card type, then click Generate.
Worked example
Generates a 16-digit Visa-format number that passes the Luhn check.
How to use this calculator
- Enter the card prefix or digit pattern you want to test.
- Apply the Luhn rules to the digits by doubling every second digit from the right.
- Subtract 9 from any doubled digit greater than 9, then add all digits together.
- Choose the final check digit so the total becomes divisible by 10.
The formula explained
$$ \text{Check digit} = \left(10 - \left(\sum \text{processed digits} \bmod 10\right)\right) \bmod 10 $$
- \(\text{check digit}\) = the final digit chosen so the full number passes the Luhn check
- \(\text{processed digits}\) = the digits after doubling every second digit from the right and reducing any doubled result above 9 by subtracting 9
- \(\text{sum}\) = the total of all processed digits
- \(mod 10\) = the remainder after dividing by 10
Step by step method
- Start with the number body you want to test, without the final check digit.
- Move from right to left and double every second digit.
- If a doubled value is 10 or more, subtract 9 from it.
- Add all the digits to get a total, then pick the check digit that makes the total end in 0.
Worked example
Suppose you want to generate a test number from the prefix 7992739871.
- Write the digits as 7, 9, 9, 2, 7, 3, 9, 8, 7, 1.
- Working from right to left, double every second digit: 1 stays 1, 7 becomes 14, 8 stays 8, 9 becomes 18, 3 stays 3, 7 becomes 14, 2 stays 2, 9 becomes 18, 9 stays 9, 7 becomes 14. Reduce doubled values above 9 by subtracting 9, so you get 1, 5, 8, 9, 3, 5, 2, 9, 9, 5.
- Add them: 1 + 5 + 8 + 9 + 3 + 5 + 2 + 9 + 9 + 5 = 56. The check digit must make the total a multiple of 10, so the final digit is 4.
- The completed Luhn-valid test number is 79927398714.
Answer. 79927398714
Tips and common mistakes
- This tool is for development and testing, not for real payment use.
- A Luhn-valid number can still be fake, so do not assume it belongs to a real account.
- Make sure you know whether you need a specific length or brand format before generating a test number.
- A common mistake is forgetting to subtract 9 from doubled digits that are 10 or higher.
Frequently asked questions
Can these be used to buy things?+
No, they are random Luhn-valid numbers with no real account behind them.
Why use them?+
To test form validation and checkout flows without real card data.
More Everyday Tools Tools
Explore related calculators in this category
Age Calculator
Calculate exact age in years, months, and days. Use this free calculator for fast, accurate answers, complete with the formula and a worked example.
Alcohol Dilution Calculator
Calculate water to add to dilute a spirit to a target ABV.
Appliance Energy Cost Calculator
Estimate the running cost of an appliance from its wattage.
Audiobook Length Calculator
Estimate listening time at different playback speeds.
You Might Also Like
Popular tools from other categories
Absolute Value Calculator
Calculate the absolute value of any number. Use this free calculator for fast, accurate answers, complete with the formula and a worked example.
AC to DC Converter Calculator
Convert AC voltage to DC voltage for different rectifier configurations. Free online calculator with instant, step-by-step results.
Acid-Base Titration Calculator
Calculate concentration from titration data. Get quick, accurate results with this free online calculator, including formulas and worked examples.
ABV Calculator
Calculate alcohol by volume from original and final gravity. Free calculator with instant calculations, the underlying formula, and an easy-to-follow example.
Can't Find the Right Calculator?
Try our AI Math Solver, type any problem in plain English and get instant step-by-step solutions.