Skip to main content
CheckTown
Dev Tools

Base32 Encoding: A Complete Guide

Published 5 min read
In this article

What Is Base32?

Base32 is a binary-to-text encoding scheme defined in RFC 4648 that represents binary data using a set of 32 characters (A-Z and 2-7). Unlike Base64, Base32 uses only uppercase letters and digits, making it case-insensitive and human-friendly for manual entry.

Base32 produces longer output than Base64 (approximately 60% overhead vs 33%), but the trade-off is improved readability and compatibility with systems that are case-insensitive or disallow special characters like + and /.

How Base32 Encoding Works

Base32 converts each group of 5 bytes (40 bits) into 8 Base32 characters (5 bits each), padding with = characters when the input length is not a multiple of 5.

  • 5-bit grouping — input bytes are split into 5-bit chunks, each mapping to one of 32 characters from the A-Z, 2-7 alphabet
  • Padding — = characters pad the output to ensure the length is always a multiple of 8 characters
  • Variants — Base32Hex uses 0-9, A-V instead of A-Z, 2-7 to preserve sort order of encoded data

Try it free — no signup required

Encode or Decode Base32 →

When To Use Base32

Base32 is preferred over Base64 in scenarios where case sensitivity, readability, or character restrictions matter.

  • TOTP secrets — authenticator apps like Google Authenticator use Base32-encoded secrets because users may need to type them manually
  • Crockford encoding — a Base32 variant that removes ambiguous characters (I, L, O, U) for cleaner human-readable identifiers
  • DNS and file systems — Base32 works in case-insensitive environments where Base64's mixed-case alphabet would cause collisions

Frequently Asked Questions

What is the difference between Base32 and Base64?

Base32 uses 32 characters (A-Z, 2-7) and produces roughly 60% larger output, while Base64 uses 64 characters (A-Z, a-z, 0-9, +, /) with about 33% overhead. Base32 is case-insensitive and avoids special characters, making it better for manual entry and case-insensitive systems.

Why do authenticator apps use Base32 instead of Base64?

Authenticator apps use Base32 because users sometimes need to manually type the secret key. Base32's uppercase-only alphabet avoids confusion between similar-looking characters (like lowercase L and digit 1) and works reliably when copied between case-insensitive systems.

What is Base32Hex and when should I use it?

Base32Hex (also called base32hex or extended hex) uses the characters 0-9 and A-V instead of the standard A-Z, 2-7 alphabet. It preserves the lexicographic sort order of the original binary data when encoded, which is useful for database indexing and sorted data structures.

Related Tools