Credit card security: Secret code in credit card numbers © Getty Images

The Basics

The credit card 'Da Vinci Code'

A pre-computer security feature was slipped into your credit card numbers and remains there today. Pull out a card and a pencil to see the math trick for yourself.      

By CreditCards.com

Did you know your credit card has a "Da Vinci Code"?

It's true. Those raised numerals on your card are not only your account identifier that banks and merchants need to transact business on your behalf, but a little-known credit card version of the Da Vinci Code that verifies its validity without the aid of computers.

"It's pretty cool that something that was developed pre-computer is still in use today. I think that's really important," says Derrick Niederman, an MIT-educated mathematician, New York Times crossword puzzle creator and author of many recreational math books, including "Number Freak."

Even cooler, the code, which can reveal whether a credit card number is fraudulent, is cryptically hidden within the sequence of the card numbers. Every legitimate credit, debit and ATM card on Earth contains this formula.

What's in your wallet, Dan Brown?

This low-tech mathematical sleight of hand, dubbed the Luhn formula after its inventor, Hans Peter Luhn, played a tangential role in the development of the World Wide Web, search engines such as Google, text messaging and other high-tech wonders.

Check number, please!

In the unlikely event that you've given any thought at all to your credit card numbers, you probably view them as merely series of random numerals: 16 digits on Visa, MasterCard and Discover cards, 15 on American Express cards and 14 on Diner's Club/Carte Blanche cards.

On a 16-digit card, the first six numerals identify the card issuer, and the next nine numerals are the card account number (AmEx uses an eight-digit account number.)

But there is absolutely nothing random about the final digit of your credit or debit card number. It has been appended as a so-called check number, or key, to verify the card is valid. It's this check number that gives the Luhn formula its Da Vinci Code allure.

When a card number is generated using Luhn's algorithm, various combinations of the digits on the card must ultimately add up to a number that is perfectly divisible by 10. For this reason, Luhn's formula is also referred to as modulus 10, or mod 10 for short. Change any digit or transpose nearly any two digits, and the Luhn check will catch it.

"At its essence, an algorithm is a mechanizing device. It's a machine of sorts," Niederman says.

The Luhn formula was designed to instantly detect accidental data entry errors -- missed keystrokes, transpositions and the like -- not as a defense against fraud. It doesn't identify where an invalid number went sideways; it simply flags it as nonconforming.

Luhn checking won't tell you anything about the underlying card account itself. Nor should it be confused with card-verification-value codes, those extra, unembossed numbers on major credit cards that attempt to verify that the physical card is (or has been) in your possession.

Continued: Thread counts and keywords

More from MSN Money and CreditCards.com

 1 | 2 | next >

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest). LowHigh
CreditCards.com