Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Luhn Algorithm Checker

Validate credit card numbers, IMEI codes, and other IDs using the Luhn checksum formula

Your files never leave your browser
Ready·
Disclaimer: This tool validates the Luhn checksum algorithm only. It does not verify if a card number is real, active, or associated with any account.

Paste a credit card number, IMEI, or any Luhn-validated ID and get an instant pass or fail — with a full step-by-step digit breakdown so you can see exactly where the math lands. Batch mode handles multiple numbers at once, and Check Digit mode calculates that missing last digit for you. And everything runs in your browser. Nothing gets uploaded.

How It Works

Enter Number
→
Double & Sum Digits
→
Check Mod 10

The Luhn formula starts from the right side of the number. Every second digit gets doubled — if doubling pushes it past 9, subtract 9. Then all the digits are added together. If the total is divisible by 10, the number is valid. That's it. Hans Peter Luhn patented this back in 1954 and it's still the standard check on billions of card transactions every day.

Examples

Validating a Visa Card Number

Testing a sample Visa number to confirm it passes the Luhn check before submitting a payment form.

INPUT
4539 1488 0343 6467
OUTPUT
✓ Valid — Luhn check passed Sum: 60 (divisible by 10)

Catching a Typo in an IMEI

Someone copied an IMEI off a phone sticker and one digit is wrong. The Luhn check catches it right away.

INPUT
490154203237518
OUTPUT
✗ Invalid — Luhn check failed Sum: 53 (not divisible by 10)

Generating a Check Digit for a Partial Card Number

You have the first 15 digits of a 16-digit number and need to figure out what the last digit should be. Switch to Check Digit mode and paste the partial number.

INPUT
453914880343646 (15 digits, Check Digit mode)
OUTPUT
Check digit: 7 Full number: 4539148803436467

Who Uses This

👨‍💻 Developers

Testing payment form validation logic before going live with a checkout flow.

🔍 QA Testers

Generating valid and invalid test card numbers for automated payment tests.

📱 Mobile Technicians

Verifying IMEI numbers when processing device trade-ins or warranty claims.

🎓 Students

Checking homework answers for computer science or discrete math assignments on checksum algorithms.

Common Mistakes

Including spaces or dashes and thinking they affect the result

The tool strips non-digit characters automatically. But if you're implementing Luhn yourself, forgetting to clean the input first is the number one source of bugs. Always strip everything that isn't 0-9 before running the algorithm.

Doubling from the wrong end

Luhn doubles every second digit starting from the right, not the left. If the number has an even count of digits, the first digit gets doubled. Odd count? Second digit. Getting this backwards will give you a wrong result every time.

Assuming a valid Luhn means the card is real

Passing the Luhn check only means the digits are mathematically consistent. It does not mean the card exists, has funds, or belongs to anyone. Plenty of random 16-digit sequences will pass Luhn by coincidence. Don't use this as a fraud check.

Technical Details

Frequently Asked Questions

What is the Luhn algorithm used for?

It's a quick error-detection formula that catches typos in numeric IDs. Credit card numbers, IMEI codes, Canadian Social Insurance Numbers, ISINs — they all use it. The algorithm doesn't prove a number is genuine. It just confirms the digits are internally consistent, which is enough to catch most accidental mistakes before a transaction even hits the network.

Can the Luhn algorithm detect all errors?

No. It catches every single-digit mistake and almost all adjacent transpositions — except swapping 0 and 9. If two non-adjacent digits are wrong, or if digits are added or removed, Luhn won't reliably flag it. It was designed for accidental entry errors, not for detecting deliberate tampering.

Is it safe to check my real credit card number here?

Yes. The validation happens entirely in your browser using JavaScript. Your card number is never sent to a server, stored in a database, or logged anywhere. You can disconnect from the internet and it'll still work — that's how you know nothing is being transmitted.

How do I calculate the Luhn check digit manually?

Take all digits except the last position. Starting from the right, double every second digit (subtract 9 if the result exceeds 9). Add everything up. The check digit is whatever value makes the total a multiple of 10. So if your sum is 53, the check digit is 7 because 53 + 7 = 60. Or skip the math and use the Check Digit mode on this page.

Do all credit cards use the Luhn algorithm?

Pretty much. Visa, Mastercard, American Express, Discover, JCB, Diners Club — they all require the card number to pass Luhn validation. It is part of the ISO/IEC 7812-1 standard that governs card numbering. Some prepaid or virtual cards might look different, but if they carry a major network logo, they follow Luhn.

Share: