npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@didrod2539/checkdigit

v0.2.0

Published

Validate & generate checksummed identifiers — credit cards (Luhn), IBANs (mod-97), ISBN-10/13, and EAN/UPC barcodes — with exact check-digit math. Zero dependencies, 100% local, no card data sent anywhere.

Downloads

288

Readme

✅ checkdigit

Validate & generate checksummed IDs — cards, IBANs, ISBNs, barcodes. Locally.

npm version bundle size CI types license

🌐 Try the free web app →  ·  paste an ID to validate, or generate test data. Nothing leaves the page.


Credit cards, bank accounts (IBAN), books (ISBN) and products (EAN/UPC barcodes) all carry a check digit — a number computed from the rest so typos can be caught instantly. The math (Luhn, mod-97, weighted sums) is exact and well-defined… and exactly the kind of thing that's tedious to implement per-format and easy for an AI to get subtly wrong.

checkdigit validates and generates all of them with the correct algorithms, zero dependencies, and 100% locally — your card number never touches a server.

📸 Screenshot / demo GIF: ./web/screenshot.png — record the live app validating a card and generating a test EAN-13.

Why it exists

  • AI can't reliably do this. Check-digit algorithms (Luhn doubling, IBAN mod-97-10, ISBN/EAN weighted sums) are precise and unforgiving — an LLM will cheerfully produce an "almost right" number that fails validation. You want a tested, deterministic implementation.
  • Privacy. Validating a card on a random website means typing your number into their server. checkdigit runs on your device.
  • One tool, every format. Stop pulling a separate micro-library (or copy-pasted snippet) for each of Luhn / IBAN / ISBN / EAN.

Who it's for

Developers (form validation without N tiny deps), QA & testers (generate valid test cards/IBANs/barcodes), e-commerce & ops (verify SKUs, orders, barcodes), finance, publishers/librarians (ISBN), and anyone who needs to check or convert an identifier.

Install

No install — just open the web app.

Command line:

npx @didrod2539/checkdigit validate 4111111111111111   # ✓ valid  credit-card (Visa)
echo "DE89 3704 0044 0532 0130 00" | npx @didrod2539/checkdigit validate
npx @didrod2539/checkdigit generate card --brand Amex  # a format-valid TEST card

Library:

npm install @didrod2539/checkdigit

Zero runtime dependencies. ESM + CJS + TypeScript types. Runs in the browser, Node, Deno and Bun.

CLI

checkdigit validate <id>     # auto-detect (card/IBAN/ISBN/barcode) + validate
checkdigit generate <kind>   # make format-valid TEST data

validate exits non-zero on an invalid check digit — handy in scripts. Generate kinds: card (--brand), isbn, barcode (--type), luhn (--length). Generated values are test data (correct checksum) — not real accounts.

Usage

import { validate, detect, luhn, creditCard, iban, isbn, barcode } from "@didrod2539/checkdigit";

// Auto-detect & validate anything
validate("4111 1111 1111 1111"); // { type: "credit-card", valid: true, detail: "Visa" }
validate("DE89 3704 0044 0532 0130 00"); // { type: "iban", valid: true, detail: "DE" }
validate("978-0-306-40615-7");   // { type: "isbn", valid: true, detail: "ISBN-13" }

// Or use a specific module
creditCard.brand("378282246310005");      // "American Express"
creditCard.generateTest("Visa");           // a Luhn-valid test number
iban.isValid("GB82 WEST 1234 5698 7654 32"); // true
isbn.to13("0306406152");                    // "9780306406157"
barcode.isValid("036000291452");            // true (UPC-A)
luhn.complete("7992739871");                // "79927398713"

What's covered

| Module | Identifiers | | ------ | ----------- | | luhn | Mod-10 (cards, IMEI…): validate, check digit, complete, generate | | creditCard | Brand detection, validation, formatting, test-number generation | | iban | ISO 13616 mod-97-10: validate, check digits, format, country | | isbn | ISBN-10 & ISBN-13: validate, check digits, convert 10 ⇄ 13 | | barcode | EAN-13, EAN-8, UPC-A: validate, check digit, generate | | detect / validate | Auto-detect the type and validate in one call |

FAQ

Is my card number sent anywhere? No. Everything runs on your device — no server, no telemetry, works offline.

Are the generated card numbers real? No. They're format-valid test numbers (correct brand prefix, length and Luhn check) for testing forms and payment flows — they are not real, usable accounts.

Does validating a card mean it will work for a payment? No — it only confirms the number is structurally valid (right format + check digit). Whether an account exists/has funds is a separate, server-side matter.

Which IBAN countries are supported? Any IBAN — validation uses the universal mod-97-10 check plus the general structure. (Per-country length tables can be added; PRs welcome.)

Can I add VIN / routing numbers / ISIN? Yes please — see CONTRIBUTING; each is a small module with its own check.

Contributing

Contributions welcome! See CONTRIBUTING.md and the Code of Conduct.

git clone https://github.com/didrod205/checkdigit.git
cd checkdigit
npm install
npm test          # run the suite
npm run dev       # run the web app locally

💖 Sponsor

checkdigit is free, MIT-licensed, and built in spare time. If it saved you a dependency (or a debugging session), please consider supporting it:

  • Star this repo — free, and it genuinely helps others find it.
  • 🍋 Sponsor via Lemon Squeezy — one-time or recurring support.

Where your support goes: more identifiers (VIN, routing/ABA, ISIN, NPI, national IDs), per-country IBAN structure validation, more card brands, a CLI, keeping the free web app online, and fast issue responses.

License

MIT © checkdigit contributors