Ask Dave Taylor
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube
  • Home
  • YouTube Channel
  • Most Popular
  • Newsletter!
  • Ask Me A Question
  • Meet Dave
  • Home
  • d) None of the Above
  • How do Credit Card Numbers Work?

How do Credit Card Numbers Work?

January 25, 2011 / Dave Taylor / d) None of the Above / 9 Comments

I mistyped a digit on my credit card last time I was shopping online and the site promptly told me the card number was invalid. But there’s no way it had time to check with the bank. Is there some secret coding system for credit card numbers that they used, and if so, how does it work?

  CLICK TO GET DAVE'S FREE NEWSLETTER! 
Guaranteed to Make you Smarter.

You’re right that the account number shown on your credit cards turns out to be quite a bit more complicated and sophisticated than you may think. It’s not, in fact, just a random sequence of digits, but rather a smart way to have tons of different card numbers available while slowing down thieves who would try to guess credit card numbers and expiration pairs.

To explain, I’m going to use a fictitious card number, but I would encourage you to pull your own credit card out of your purse or wallet and play along at home…

The first digit of a credit card number is known as its Major Industry Identifier, and the possible values give you insight into who issues credit cards for Visa and Mastercard:

Value Meaning
1 and 2 Airlines
3 Travel and Entertainment
4 and 5 Banking and Financial
6 Merchandising and Banking
7 Petroleum
8 Telecommunications
9 National assignment (whatever that means!)

When I look at the cards in my wallet, for example, my Paypal MasterCard starts with a “5”, while my Amazon.com Visa starts with a “4”.

The next five digits plus the very first digit make up the Issuer Identification Number (IIN), the bank or other institution that issued the card. This means that if I compare cards with someone else who has an Amazon Visa, for example, we should both find that it has the same IIN, which starts with 4640.

credit card graphic

Every subsequent digit on the credit card but the very last is your account number. A credit card has a maximum of 19 digits, though most use 16, meaning that there are typically 9-12 digits utilized for account numbers. Mathematically, this means that there are 10**9 possible account numbers, or a billion possible combinations. If the card issuer used 12 digits, that’d be 10**12 or 1,000,000,000 000 combinations. That’s a lot of possibilities!

The last digit is perhaps the most interesting, however, it’s the checksum and it’s a bit tricky to calculate but here’s basically how it works:

Take your credit card number and double every other digit, starting on the right.
For a sample credit card number of 4417 1234 5678 9113, that would mean that we’re going to double every other digit and skip the intervening, like this
(4*2) [4] (1*2) [7]   (1*2) [2] (3*2) [4]   (5*2) [6] (7*2) [8]   (9*2) [1] (1*2) [3]
This yields:
8 _ 2 _   2 _ 6 _   10 _ 14 _   18 _ 2 _
Any two-digit number becomes the sum of its digits, so 10 = 1 + 0, 14 = 1 + 4, 18 = 1 + 8, producing:
8 _ 2 _   2 _ 6 _   1 _ 5 _   9 _ 2 _
Now we need to fold back in the original digits that we’d skipped (I said it’s complicated!) and sum up each quad:
8+4+2+7   2+2+6+4   1+6+5+8   9+1+2+3
Total value = 70 (add it up, you’ll see).

This sum value doesn’t need to equal the last digit on the card, however, that’s just included to ensure that the digits all add up to a number that’s divisible by 10. If the last digit weren’t a 3, for example, but a 5, then we’d have ended up with 72, which would demonstrate that it’s not a valid credit card number.

Cool, eh? I imagine that the shopping site you used actually had that complicated math formula built in to the shopping cart, so it could instantly recognize that the checksum wasn’t divisible by ten and therefore you had to either have a fake card or a card with a typo somewhere in the entry.

Hope that’s helpful and interesting!

While we’re talking about this, turns out that there are also lots of types of payment methods too. But that’s a subject for a different article.

About the Author: Dave Taylor has been involved with the online world since the early days of the Internet. Author of over 20 technical books, he runs the popular AskDaveTaylor.com tech help site. You can also find his gadget reviews on YouTube and chat with him on Twitter as @DaveTaylor.

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!
credit card numbers, credit cards

9 comments on “How do Credit Card Numbers Work?”

  1. kwame says:
    April 22, 2013 at 8:09 pm

    Hi good morning how are you i need credit card

    Reply
  2. alvin says:
    November 25, 2012 at 5:49 am

    dave give me a credirt card code can?

    Reply
  3. Enzo Gorlami says:
    February 24, 2011 at 8:34 am

    good article interesting stuff – but, where did you get all of this information?

    Reply
  4. Stephen says:
    February 2, 2011 at 6:42 am

    I think I’m missing something. You say to “Start from the right” but you actually seem to be working from the left? ie starting with 44

    Reply
  5. RonF says:
    February 1, 2011 at 1:24 pm

    Cool stuff Dave, I knew about the leading number indicating which type of card it was, 4=visa, 5=mastercard 6=discover/storecards but I didn’t know about the checksum, cool stuff!

    Reply
  6. jw says:
    January 26, 2011 at 3:01 pm

    Very nice article. I’ve always wondered that as well. Thank you

    Reply
  7. Dave Taylor says:
    January 25, 2011 at 10:04 pm

    Not sure about international credit cards, but I would be unsurprised to find that it’s an int’l standard…

    Reply
  8. Bert Padilla says:
    January 25, 2011 at 6:03 pm

    Wow! I tried it with my two cards and the 16 numbers, in which I doubled every other digit as you instructed, it indeed equals to a sum divisible by ten (10). But I’m wondering if this is adopted internationally? I mean will this work in all types of credit cards?

    Reply
  9. Adam says:
    January 25, 2011 at 11:46 am

    One thing you didn’t say (but you implied) is that if it starts with a 4, it is always a Visa and if it starts with a 5, it is always a Mastercard. This is why more sophisticated shopping carts don’t ask for the type of card…it is indicated by the number itself. (I don’t have an AMEX or Discover, but apparently, they are 3 and 6 respectively)

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Recent Posts

  • Share Contact Info Cards Between iPhone and Android?
  • How Do Virtual Private Networks (VPNs) Protect my Privacy?
  • How to Use AI To Identify the Setting of a Photograph
  • What Software Do I Need to Play DVDs on my Windows PC?
  • Is Your Cloud Storage Full? Nope, it’s Spam.

On Our YouTube Channel

Hear Everything with the EKSA Telecom S30 AI-Powered Open Ear Headset

Pump It Up with the Woowind Ventus Pro Portable Air Compressor

Categories

  • AdSense, AdWords, and PPC Help (106)
  • AI and ChatGPT Help (57)
  • Alexa, Kindle, and Nook Help (105)
  • Amazon, eBay, and Online Shopping Help (172)
  • Android Help (296)
  • Apple iPad Help (156)
  • Apple Watch & Smartwatch Help (63)
  • Articles, Tutorials, and Reviews (361)
  • Auto Tech Help (26)
  • Business Advice (202)
  • Chromebook & ChromeOS Help (74)
  • Computer & Internet Basics (834)
  • d) None of the Above (170)
  • Facebook Help (397)
  • Google, Chrome & Gmail Help (215)
  • HTML & Web Page Design (249)
  • Instagram, Bluesky & Threads Help (65)
  • iPhone & iOS Help (692)
  • iPod & MP3 Player Help (173)
  • LinkedIn Help (95)
  • Linux Help (182)
  • Linux Shell Script Programming (93)
  • Mac & MacOS Help (980)
  • Most Popular (16)
  • Outlook & Office 365 Help (49)
  • PayPal Help (69)
  • Pinterest Help (58)
  • Reddit Help (23)
  • SEO & Marketing (83)
  • Spam, Scams & Security (123)
  • Trade Show News & Updates (23)
  • Video Game Tips (66)
  • Web Site Traffic Tips (62)
  • Windows PC Help (1,059)
  • Wordpress Help (207)
  • Writing and Publishing (72)
  • X/Twitter Help (230)
  • YouTube Help (52)
  • YouTube Video Reviews (159)
  • Zoom, Skype & Video Chat Help (75)

Archives

Social Connections:

Ask Dave Taylor


Follow Me on Pinterest
Follow me on Twitter
Follow me on LinkedIn
Follow me on Instagram


AskDaveTaylor on Facebook



microsoft insider mvp


This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to our terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. Our lawyer says "Thanks for your cooperation."
© 2025 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Stories, LLC.
FTC Notice: If you buy products through links on this site we may receive a modest affiliate commission. This won’t affect the price you pay.
Privacy Policy - Terms and Conditions - Accessibility Policy - Humix Video Content
  • Home
  • YouTube Channel
  • Most Popular
  • Newsletter!
  • Ask Me A Question
  • Meet Dave