Skip to content
Encode & Decode 6 min read

Base32 Encoding Explained: RFC 4648, Hex Alphabet & When to Use It

Learn how Base32 encoding works, the difference between standard Base32 and Base32hex, when Base32 beats Base64 for readability, and how to encode and decode in JavaScript and Python.

ToolsVito Team

Why Base32 Exists

Base64 uses 64 characters (A–Z, a–z, 0–9, +, /) and is compact, but it has problems: lowercase vs. uppercase ambiguity for human transcription, + and / causing URL issues, and characters like l, 1, O, and 0 looking similar. Base32 uses a 32-character alphabet (A–Z and 2–7) — all uppercase, no confusing characters, no URL-unsafe symbols. Every 5 bytes of input become 8 Base32 characters, meaning it's about 20% larger than Base64 but far more robust for human-facing use.

Standard Base32 (RFC 4648)

The standard alphabet:

A=0   B=1   C=2   D=3   E=4   F=5   G=6   H=7
I=8   J=9   K=10  L=11  M=12  N=13  O=14  P=15
Q=16  R=17  S=18  T=19  U=20  V=21  W=22  X=23
Y=24  Z=25  2=26  3=27  4=28  5=29  6=30  7=31

Notice: digits 0 and 1 are excluded because they look like O and I. Padding uses = like Base64.

Base32hex (Extended Hex Alphabet)

An alternative alphabet designed to preserve sort order — encoded data sorts the same as the original binary:

0=0   1=1   2=2   3=3   4=4   5=5   6=6   7=7
8=8   9=9   A=10  B=11  C=12  D=13  E=14  F=15
G=16  H=17  I=18  J=19  K=20  L=21  M=22  N=23
O=24  P=25  Q=26  R=27  S=28  T=29  U=30  V=31

Used in DNSSEC, TLS certificate fingerprints, and systems where sort-preserving encoding matters.

Base32 in JavaScript

// Encode using Web Crypto + manual mapping
async function toBase32(input) {
  const encoder = new TextEncoder();
  const data = encoder.encode(input);
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
  // Process 5-byte groups, output 8-char chunks
  // ... implementation uses bit shifting
}

When to Use Base32 Over Base64

  • Human transcription: Product keys, recovery codes, license keys — Base32 avoids confusion between O/0 and I/l/1.
  • Voice dictation: Speaking a Base32 string is unambiguous. No "capital A" or "lowercase a" distinction.
  • OCR and barcodes: Uppercase-only, no symbols = higher scan accuracy.
  • DNS labels: Base32hex is used in DNSSEC and other DNS security records.
  • File systems: Case-insensitive file systems don't corrupt Base32 filenames.

Encode & Decode Base32 Instantly

Use ToolsVito's Base32 Encoder/Decoder to encode text to Base32 or decode Base32 back, with support for both standard RFC 4648 and extended hex alphabets. All processed in your browser.

Try it now — free, runs in your browser

Base32 Encode / Decode

Text ↔ Base32 (RFC 4648)