Base32 Encoder Decoder
Encode and decode Base32 strings (RFC 4648). Perfect for TOTP secrets, DNSSEC records, and case-insensitive data. Free, instant, and 100% client-side.
- Home
- Encoder & Decoder
- Base32 Encoder & Decoder
Lowercase input and missing padding are handled automatically.
Ctrl+Enter convert
What is Base32 Encoding?
Base32 is a binary-to-text encoding scheme defined in RFC 4648 that converts binary data into a printable ASCII string format. It uses 32 characters (A-Z and 2-7) to represent binary data in a human-readable way. Base32 encoding is commonly used for TOTP secrets, DNSSEC records, hash visualization, and other applications where a case-insensitive alphanumeric encoding is preferred.
The term "Base32" comes from the fact that the encoding uses a base-32 numeral system to represent 5 bits of data using each character. Every 5 bytes (40 bits) of input are encoded into 8 Base32 characters (each representing 5 bits). This means that Base32-encoded data is approximately 60% larger than the original binary data (compared to Base64's 33% overhead).
Base32 encoding works by taking the binary representation of the input data and grouping it into 5-bit chunks. Each 5-bit chunk is then converted to its corresponding Base32 character. If the input data is not a multiple of 5 bytes, padding characters (=) are added to make the output length a multiple of 8 characters.
When Should You Use Base32 Encoding?
- TOTP Secrets — Google Authenticator and other 2FA apps use Base32-encoded secrets (RFC 6238)
- DNSSEC Records — DNS security extensions use Base32 for NSEC record hashes (RFC 5155)
- Hash Visualization — SSH key fingerprints and OpenPGP keys use Base32 for human-readable identification
- Case-Insensitive Data — When encoding needs to be case-insensitive (Base32 uses only uppercase letters)
- Human Transcription — When codes need to be read aloud or transcribed manually without confusion between similar characters
Base32 vs. Base64
While Base64 is more space-efficient (33% overhead vs 60% for Base32), Base32 offers advantages in specific scenarios:
- Case insensitivity — Base32 uses only uppercase letters, making it suitable for voice transcription
- No ambiguous characters — Doesn't use 0, 1, 8, 9, +, or / that can be confused
- URL-safe by default — The Base32 alphabet contains no characters with special meaning in URLs
- Standard for 2FA — Required for compatibility with Google Authenticator and most TOTP apps
Base32 in Code
JavaScript (Browser)
// Base32 encode a TOTP secret
const secret = "JBSWY3DPEHPK3PXP";
const bytes = new TextEncoder().encode(secret);
const base32 = toBase32(bytes);
console.log(base32);
Python
import base64
# Base32 encode
data = b"Hello"
encoded = base64.b32encode(data).decode()
# "JBSWY3DPEE======"
# Base32 decode
decoded = base64.b32decode(encoded)
Node.js
const buf = Buffer.from("JBSWY3DPEHPK3PXP");
// Decode Base32 via manual lookup...
How to Use This Base32 Encoder/Decoder
- Choose your mode — Click the toggle switch to select Encode (text → Base32) or Decode (Base32 → text).
- Enter your data — Type or paste text directly into the input area.
- Submit — Click the Encode or Decode button to process your data.
- Copy the result — Use the copy button in the result panel to copy the output to your clipboard instantly.
Frequently Asked Questions
What characters does Base32 use?
Base32 (RFC 4648) uses 32 characters: the letters A-Z (26 characters) and the digits 2-7 (6 characters). Padding uses = when necessary.
What is the difference between Base32 and Base64?
Base32 encodes 5 bits per character with ~60% overhead, while Base64 encodes 6 bits per character with ~33% overhead. Base32 uses only uppercase letters and digits, making it case-insensitive and easier to read aloud, but produces longer output.
Why is Base32 used for TOTP secrets?
TOTP (RFC 6238) recommends Base32 for encoding secrets because it's case-insensitive, avoids visually ambiguous characters, and can be easily entered manually if QR code scanning fails.
Why does Base32 output sometimes end with = or == or ===?
Padding characters (=) are added when the input length is not a multiple of 5 bytes. The output must be a multiple of 8 characters. One = is added for 1 byte remainder, three === for 2 bytes, four ==== for 3 bytes, and two == for 4 bytes.
Is there a URL-safe version of Base32?
The standard Base32 alphabet (RFC 4648) does not contain any characters with special meaning in URLs (no +, /, or = in the main alphabet). The padding = can be safely omitted when used in URLs.
Related Encoder & Decoder Tools
Base64 Encoder/Decoder
Encode and decode Base64 strings
Hex Encoder/Decoder
Encode/decode text to/from hexadecimal
Binary Encoder/Decoder
Encode/decode text to/from binary
Punycode Converter
Convert domain names to/from Punycode
Text Encoder/Decoder
Encode/decode text in various formats