Utility

Luhn Algorithm Calculator

Validate any Luhn protected identifier or generate the missing check digit. Works for card numbers, IMEI, SIM ICCID, Canadian SIN, national provider identifiers and any other mod-10 number.

Last reviewed by the Radiatus Cloud team

Result appears here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

One algorithm behind many identifiers

The Luhn formula, patented in 1954 and now in the public domain as ISO/IEC 7812-1, is the mod-10 checksum used by payment card numbers, IMEI device identifiers, SIM card ICCIDs, the Canadian Social Insurance Number, the US National Provider Identifier and a long list of other schemes. It exists to catch the errors humans make when copying digits, and it is deliberately simple enough to compute by hand.

How the check works

Starting from the rightmost digit and moving left, every second digit is doubled. A doubled result above nine has nine subtracted, which is the same as adding its two digits. All the digits are then summed, and a valid number leaves a total that is a multiple of ten. The check digit is whatever value makes that true. This catches every single digit error and almost every transposition of adjacent digits, which together account for the large majority of manual copying mistakes.

What it does not catch

Luhn does not catch a transposition of 09 and 90, and it is not a security measure of any kind. A number passing the check is well formed, not valid, not active and not authorised. Any system that treats a passing Luhn check as verification of a payment instrument has confused a typo detector with an authorisation, which is a mistake with a long history.

Related tools

  • User Agent Parser — Parse a User-Agent string into browser, engine, operating system and device. Explains why UA strings are unreliable and what to use instead.
  • QR Code Generator — Generate QR codes for URLs, text, Wi-Fi and contact details. Adjustable error correction and size, produced entirely in your browser.
  • Credit Card Validator — Validate a card number with the Luhn algorithm and identify the issuing network from its prefix. Runs locally, nothing is transmitted.
  • Text Case Converter — Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case and sentence case. Runs entirely in your browser.

Frequently Asked Questions

Does a valid Luhn check mean a card is real?

No. It means the digits are internally consistent, so a typo is unlikely. Whether the account exists, is open and has funds can only be answered by the issuing bank through an authorisation request.

Which digits get doubled?

Every second digit counting from the right, starting with the digit immediately left of the check digit. The check digit itself is never doubled. Working from the right rather than the left is what makes the rule independent of the number length.

Can I use this to generate a card number?

It generates the check digit that makes a number arithmetically valid, which is what test data generation needs. It cannot make an unissued number into a working payment instrument, and no algorithm can.

Which identifiers use Luhn?

Payment cards under ISO/IEC 7812, IMEI numbers, SIM ICCIDs, the Canadian Social Insurance Number, the US National Provider Identifier, some loyalty and membership schemes, and many internal identifier formats that adopted it for the same reason.

What error types does it miss?

Transposing 09 to 90 and a few twin digit errors such as 22 to 55 pass undetected. Schemes needing stronger detection use mod-11 or the Damm and Verhoeff algorithms instead, at the cost of being harder to compute by hand.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Paste a number to validate it, or a number without its final digit to compute the check digit.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.