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

base32kit

v0.1.1

Published

Tiny, isomorphic Base32 codec — RFC 4648, base32hex, and Crockford, between string and Uint8Array. Zero dependencies.

Readme

base32kit

All Contributors

Tiny, isomorphic Base32 codec — RFC 4648, base32hex, and Crockford, between strings and Uint8Array. Zero dependencies.

CI npm version bundle size types license

Buffer doesn't do Base32, and you reach for it when handling TOTP/2FA secrets (RFC 4648) or Crockford ids. base32kit covers all three common alphabets, both directions, between strings and bytes — the same in Node and the browser. Zero dependencies. (For Base64/hex, see its sibling codeckit.)

import { encode, decode } from "base32kit";

encode("foobar");                 // "MZXW6YTBOI======"
decode("MZXW6YTBOI======");       // "foobar"
encode("id", { variant: "crockford" }); // unpadded Crockford

Why base32kit?

  • Three alphabets. rfc4648 (default, A–Z2–7), hex (base32hex, 0–9A–V), and crockford (0–9A–Z minus I L O U, case-insensitive, no padding).
  • Tolerant decoding. Case-insensitive, ignores padding, whitespace, and -; Crockford also accepts O→0 and I/L→1.
  • RFC-correct. Passes the RFC 4648 §10 test vectors exactly.
  • Bytes or text. Low-level Uint8Array functions plus UTF-8 text wrappers.
  • Isomorphic & tiny. Node, Deno, Bun, browsers. Full types, ESM + CJS, zero dependencies.

Install

npm install base32kit
# or: pnpm add base32kit  /  yarn add base32kit  /  bun add base32kit

Text

import { encode, decode } from "base32kit";

encode("foobar");                          // "MZXW6YTBOI======"
encode("foobar", { pad: false });          // "MZXW6YTBOI"
encode("foo", { variant: "hex" });         // "CPNMU==="
decode("mzxw6ytboi", { variant: "rfc4648" }); // "foobar" (case + padding tolerant)

Bytes

import { bytesToBase32, base32ToBytes } from "base32kit";

bytesToBase32(new Uint8Array([1, 2, 3, 4, 5]));                 // RFC 4648
bytesToBase32(secret, { variant: "crockford" });               // unpadded
base32ToBytes("JBSWY3DPEHPK3PXP");                             // → Uint8Array

// TOTP secret → bytes
const key = base32ToBytes(otpSecret.replace(/\s/g, ""));
interface EncodeOptions {
  variant?: "rfc4648" | "hex" | "crockford"; // default "rfc4648"
  pad?: boolean; // default: on for rfc4648/hex, off for crockford
}

Contributors ✨

This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

License

MIT © Tung Tran