Utility Coder
Back to Blog
encoding

BASE32 Encode

Andy Pham
base32 encode, base32 encode, base32 encode online

Ready to try BASE32 Encode?

Access the free online tool now - no registration required

Open Tool

BASE32 Encode - Complete Guide

Base32 encoding converts binary data to text using 32 ASCII characters (A-Z and 2-7). Unlike Base64, Base32 is case-insensitive and avoids confusing characters, making it ideal for human-readable codes, secret keys, and environments where case matters.

How It Works

Base32 groups input into 5-byte (40-bit) chunks, then splits into 8 groups of 5 bits each. Each 5-bit value (0-31) maps to one character: A-Z (0-25) and 2-7 (26-31). Padding with = ensures output length is multiple of 8.

Technical Details

RFC 4648 defines standard Base32 alphabet. 5 input bytes become 8 output characters (60% expansion). Variants: Base32hex (0-9, A-V), Crockford Base32 (excludes I, L, O, U to avoid confusion). Case-insensitive: ABC = abc.

Common Use Cases

  1. TOTP Secret Keys: Two-factor authentication apps use Base32 for secret key encoding.
    • Example: JBSWY3DPEHPK3PXP (Google Authenticator)
  2. Human-Readable Codes: License keys, activation codes that users type manually.
  3. File Systems: Safe encoding for case-insensitive file systems (Windows).
  4. URL-Safe Identifiers: No special characters means no URL encoding needed.

Code Examples

Base32 Encoding

const BASE32_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';

function base32Encode(input) {
  const bytes = new TextEncoder().encode(input);
  let bits = '';
  for (const byte of bytes) {
    bits += byte.toString(2).padStart(8, '0');
  }

  // Pad to multiple of 5
  while (bits.length % 5 !== 0) bits += '0';

  let result = '';
  for (let i = 0; i < bits.length; i += 5) {
    const chunk = bits.slice(i, i + 5);
    result += BASE32_CHARS[parseInt(chunk, 2)];
  }

  // Add padding
  while (result.length % 8 !== 0) result += '=';
  return result;
}

base32Encode('Hello');  // "JBSWY3DP"

Convert to bits, group by 5, map to Base32 alphabet, add padding.

Tips & Best Practices

  • Use for TOTP/2FA secret keys
  • Case-insensitive - normalize before comparing
  • No URL encoding needed
  • Crockford variant avoids ambiguous characters
  • 60% larger than input (vs 33% for Base64)

Common Mistakes to Avoid

  • Using when Base64 would be more efficient
  • Assuming it provides security (it does not)
  • Not handling padding correctly
  • Case sensitivity issues in comparison

When to Use This Tool

Use Base32 for TOTP secrets, human-readable codes, case-insensitive systems, and when users need to type encoded values. Use Base64 when compactness matters more.

Frequently Asked Questions

Why use Base32 instead of Base64?

Base32 is case-insensitive, avoids confusing characters (0/O, 1/l), and is URL-safe without encoding. Use it when humans need to read/type the encoded data. Base64 is more compact (33% vs 60% overhead).

What are the 32 characters?

A-Z (26 letters) plus 2-7 (6 digits). Excludes 0, 1, 8, 9 to avoid confusion with O, I/L, B. The = character is used for padding only.

Why is my output padded with =?

Base32 output must be a multiple of 8 characters. Padding indicates how many bytes were in the last incomplete group. 1-6 padding = signs depending on input length.

Is Base32 secure for passwords?

Base32 is encoding, not encryption. It provides no security - anyone can decode it. Use it for transport/storage format, not security. For passwords, use proper hashing (bcrypt, Argon2).

Get Started

Ready to try BASE32 Encode? Use the tool now - it's free, fast, and works right in your browser.


Last updated: June 27, 2026

Start using BASE32 Encode

Free, fast, and privacy-focused - try it now

Launch Tool