# How Can You Tell If a Credit Card Number Is Valid?

With so many websites offering free financial tools, it can be hard to know whom to trust. At NerdWallet, we spend literally 1,000s of hours researching partner offers and following strict editorial integrity to match you with the perfect choice. We even share how we make money so you can enjoy our expert advice and researched recommendations with total clarity and confidence.

Have you ever wondered how credit card numbers are chosen? Turns out, it’s not just an arbitrary grouping of numbers. A combination of the Luhn algorithm, MIIs and IINs dictate the 15-16 digits emblazoned on your favorite piece of plastic (or metal). Here’s a brief description of all three — pull out your credit card and check it out.

### What’s the Luhn algorithm?

The Luhn algorithm, also known as the modulus 10 algorithm, is a formula used to determine the validity of certain numbers, including credit card numbers. Through a series of additions and multiplications, a final number that is a multiple of 10 means your card is likely valid.

This algorithm was created to protect against accidental errors and distinguish valid credit card (and other) numbers from random collections of numbers. It can also be used to determine if a card is fraudulent.

Curious? Here’s how vendors determine whether or not your card is valid. You’ll notice there are two options below for the fifth step, labeled (a) and (b). You can choose either, the result will be the same.

Step 1: Write down the last 10 digits of your credit card number. As an example, I’m using the ten digits of “0-0-0-8-2-9-8-7-0-1.”

Step 2: Double every other number starting from the right. (1 x 2) = 2, (7 x 2) = 14, (9 x 2) = 18, (8 x 2) = 16, (0 x 2) = 0

Step 3: For the double-digit numbers, add the two digits together. (1 + 4) = 5, (1 + 8) = 9, (1 + 6) = 7

Step 4: Add it all together. 0 + 0 + 0 + 7 + 2 + 9 + 8 + 5 + 0 + 2 = 33

Step 5(a): Multiply it by 9. 33 x 9 = 297

Step 5(b): Subtract the last digit of Step 4 from 10. 10 – 3 = 7

Step 6: Add the number from Step 4 to the last digit of the number from Step 5. 33 + 7 = 40

Step 7: Is it a multiple of 10? Awesome, your card is probably valid!

### What’s an MII?

An MII, or Major Industry Identifier, is the first digit of your credit card number. It might seem meaningless to you, but it represents the category of entity that issued the card. For example, numbers 3 through 6 all represent some type of banking and financial institution, 1 and 2 represent airlines, and 8 represents health care and telecommunications.

### What’s an IIN?

An IIN, or Issuer Identification Number, includes the first six digits of your credit card number. These digits represent the institution that issued the card, like Visa and MasterCard, and the first 1-6 numbers are predetermined. For example, your American Express card will start with 34 or 37, your MasterCard will start with 50-55, and your Visa will start with 4.

Credit cards image via Shutterstock