# Luhn formula

Based on ANSI X4.13, the LUHN formula (also known as the modulus 10 -- or mod 10 -- algorithm ) is used to generate and/or validate and verify the accuracy of credit-card numbers.

Most credit cards contain a check digit, which is the digit at the end of the credit card number. The first part of the credit-card number identifies the type of credit card (Visa, MasterCard, American Express, etc.), and the middle digits identify the bank and customer.

To generate the check digit, the LUHN formula is applied to the number. To validate the credit-card number, the check digit is figured into the formula.

Here's how the algorithm works for verifying credit cards; the math is quite simple:

1) Starting with the second to last digit and moving left, double the value of all the alternating digits.

2) Starting from the left, take all the unaffected digits and add them to the results of all the individual digits from step 1. If the results from any of the numbers from step 1 are double digits, make sure to add the two numbers first (i.e. 18 would yield 1+8). Basically, your equation will look like a regular addition problem that adds every single digit.

3) The total from step 2 must end in zero for the credit-card number to be valid.

The LUHN formula was created in the late 1960s by a group of mathematicians. Shortly thereafter, credit card companies adopted it. Because the algorithm is in the public domain, it can be used by anyone.

The LUHN formula is also used to check Canadian Social Insurance Number (SIN) validity. In fact, the LUHN formula is widely used to generate the check digits of many different primary account numbers. Almost all institutions that create and require unique account or identification numbers use the Mod 10 algorithm.

Top Terms
• 1

## ERP module - Enterprise Resource Planning module

ERP (Enterprise Resource Planning) software consists of multiple enterprise software modules that are individually purchased.

• 2

## DevOps - development and operations

DevOps (development and operations) is an enterprise software development phrase used to mean a type of agile relationship between Development and...

• 3

## two tier enterprise resource planning (ERP)

Two-tier enterprise resource planning (ERP) is used by an organization to run two integrated ERP systems simultaneously. One system, the legacy...

## Connect with Webopedia

• ### VMware Virtual SAN Explained

Here's what you need to know about VMware's vSAN software-defined storage (SDS) offering.

Did You Know? Archive »

• ### Cloud Dictionary: 50 Cloud Computing Terms to Know

From planning a private cloud project to finding an online cloud storage provider, Webopedia's A-Z Cloud Computing Glossary will help you understa..

• ### 10 Essential Social Networking Tools to Save Time

These free social networking tools that can help you manage numerous social networking and bookmarking accounts, plus save you time by aggregating yo..

• ### 5 Open Source Tools for Web Developers

There's always something new in open source software. One trend is the sheer volume of projects surrounding JavaScript and Web development.

..

• ### Server Types

Different servers do different jobs, from serving email and video to protecting internal networks and hosting Web sites. Learn about the many type..