Base32 Encoder / Decoder
Encode and decode text using Base32 encoding.
About this tool
Base32 is a binary-to-text encoding scheme that converts raw data into a 32-character alphabet (A-Z and 2-7), making binary information safe for transmission through text-based systems. Unlike Base64, which is more compact, Base32 prioritizes robustness and readability—its limited character set avoids confusion between similar-looking letters (like 'O' and '0') and works reliably across different character encodings. Base32 is particularly valuable in authentication systems (TOTP tokens for two-factor authentication), DNS zone files, file naming systems, and anywhere secure, unambiguous data representation is critical.
To use this tool, paste or type your data in the input field and select either 'Encode' to convert raw text or binary data into Base32 format, or 'Decode' to convert Base32-encoded text back to its original form. The tool handles both text and binary inputs seamlessly, automatically processing the data and displaying the result instantly. Common use cases include generating or verifying two-factor authentication codes, safely embedding data in URLs, converting binary files for storage or transmission, and ensuring data integrity when moving information across systems with different character support.
One advantage of Base32 over other encodings is its case-insensitivity—both uppercase and lowercase versions decode identically, reducing transcription errors in manual entry. The encoding expands data size by about 60%, which is larger than Base64 but still manageable for most applications. If you're working with authentication apps, distributing QR codes with encoded data, or need a human-friendly encoding that minimizes ambiguity, Base32 is often the ideal choice.
Frequently Asked Questions
Code Implementation
import base64
# Encode bytes to Base32
data = b"Hello, World!"
encoded = base64.b32encode(data).decode()
print("Encoded:", encoded) # JBSWY3DPEB3W64TMMQ======
# Decode Base32 back to bytes
decoded = base64.b32decode(encoded)
print("Decoded:", decoded.decode()) # Hello, World!
# Base32 for TOTP secret generation
import os
totp_secret = base64.b32encode(os.urandom(20)).decode().rstrip("=")
print("TOTP Secret:", totp_secret) # e.g. JBSWY3DPEB3W64TM
# Decode without padding (common in authenticator apps)
def b32decode_nopad(s: str) -> bytes:
pad = (8 - len(s) % 8) % 8
return base64.b32decode(s.upper() + "=" * pad)Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.