Luhn Algorithm Validator and Check Digit Generator
Type a number and see at once whether it passes the Luhn check, with a table showing which digits are doubled and what each adds to the total. If it fails, the tool shows which last digit would make it pass. Switch tabs to add the correct check digit to any number. Everything runs in your browser.
The digits add up to 30, and 30 is a multiple of 10.
The first digits match Visa, which uses 13 to 19 digits. This number has 16.
| Digit | Doubled? | After doubling | Adds |
|---|---|---|---|
| 4 | Yes | 8 | 8 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
| 1 | Yes | 2 | 2 |
| 1 | No | 1 | 1 |
Counting from the right, every second digit is doubled, and a doubled digit above 9 has 9 taken off. The last digit, the check digit, is never doubled.
The Luhn algorithm adds a check digit that catches common typing mistakes. It detects every single wrong digit and almost every swap of two neighbouring digits, but not 09 swapped with 90. It is not a security feature, and a number that passes is not proof that a card or account exists. Use test numbers, not real ones: the check runs in your browser and nothing is sent anywhere, but real card numbers do not belong in any tool you do not need to enter them in.
Related Tools
[5 suggestions]Hash Generator (MD5, SHA-1, SHA-256, SHA-512)
Generate MD5, SHA-1, SHA-256, and SHA-512 cryptographic hashes live from any text using the native Web Crypto API.
Developer & WebNumber Base Converter
Convert whole numbers between binary, octal, decimal, hex and any base from 2 to 36, with two's complement.
Developer & WebBase64 Encoder / Decoder
Easily encode plain text to Base64 format or decode Base64 back to readable text.
Developer & WebUUID Generator
Generate cryptographically random UUID v4 identifiers instantly, one or in bulk.
Developer & WebBitwise Calculator
Apply AND, OR, XOR, NOT, shifts and rotations to 8, 16, 32 or 64-bit numbers and see the result in binary, hexadecimal and signed and unsigned decimal.
Developer & WebAbout the Luhn Algorithm Validator and Check Digit Generator
The Luhn algorithm is a checksum that catches typing mistakes. Starting from the rightmost digit and moving left, every second digit is doubled, and a doubled digit above 9 has 9 subtracted. All the digits are then added up, and the number is valid when the total is a multiple of 10. The last digit of a number is the check digit, chosen so that the total comes out right. For example, 79927398713 has a digit sum of 70, so it passes, while changing its last digit to 0 makes the sum 67 and it fails. The check detects every single wrong digit and almost every swap of two neighbouring digits, but not 09 swapped with 90, and some twin errors such as 22 and 55 can also slip through. It is used for payment card numbers, IMEI numbers, SIM card numbers and several national ID and provider numbers. Payment card numbers run from 8 to 19 digits, and the first digits identify the network: Visa starts with 4, Mastercard with 51 to 55 or 2221 to 2720, American Express with 34 or 37. The tool names the likely network from those first digits and checks the length. The Luhn check is not a security feature. It was designed to protect against accidental errors, not against fraud, and a number that passes is not proof that a card exists or has funds. Use test numbers in tools like this, such as 4111 1111 1111 1111, and never enter real card details where you do not need to.
How does the Luhn algorithm work?▾
From the right, double every second digit, subtract 9 from any result above 9, and add up all the digits. If the total is a multiple of 10, the number is valid. The rightmost digit, the check digit, is not doubled.
What numbers use the Luhn check?▾
Payment card numbers, IMEI numbers, SIM card numbers, and several national ID and provider numbers, such as Canadian social insurance numbers and US National Provider Identifiers.
What mistakes does the Luhn algorithm catch?▾
Every single wrong digit, and almost every swap of two adjacent digits. The one swap it misses is 09 and 90. It does not catch every pair of twin errors, so it reduces mistakes without removing them.
Does a number that passes the Luhn check exist?▾
Not necessarily. Passing only means the digits are consistent. Millions of numbers pass without belonging to any real card or device, so the check cannot confirm that an account is real.
Is my data uploaded?▾
No. The calculation runs in your browser and nothing you enter is sent anywhere.