Skip to main content

Test Credit Card Number Generator

Generate Luhn-valid test card numbers for development.

Reviewed for accuracy by the Math Ora X team Last updated

Result

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

  1. Enter the card prefix or digit pattern you want to test.
  2. Apply the Luhn rules to the digits by doubling every second digit from the right.
  3. Subtract 9 from any doubled digit greater than 9, then add all digits together.
  4. 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

  1. Start with the number body you want to test, without the final check digit.
  2. Move from right to left and double every second digit.
  3. If a doubled value is 10 or more, subtract 9 from it.
  4. 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.

  1. Write the digits as 7, 9, 9, 2, 7, 3, 9, 8, 7, 1.
  2. 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.
  3. 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.
  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

You Might Also Like

Popular tools from other categories

Can't Find the Right Calculator?

Try our AI Math Solver, type any problem in plain English and get instant step-by-step solutions.

Try AI Solver

Browse All Categories

Home Everyday Tools Current Tool
Facebook Twitter WhatsApp