Base32 Encoder / Decoder
Encode text or hex bytes to RFC 4648 Base32, or decode Base32 — including TOTP / 2FA secrets — back to text or hex. Case-insensitive, tolerant of spaces and missing padding, and fully in your browser.
Base32 output
Output will appear here…When you need a Base32 converter
Base32 turns bytes into a string made only of the letters A–Z and the digits 2–7. Because there is no lowercase, no punctuation and none of the easily confused digits 0, 1, 8 and 9, a Base32 value survives case-insensitive systems and can be read aloud or typed by hand. That is why the secret behind authenticator apps, shown under a 2FA QR code as something like JBSWY3DPEHPK3PXP, is Base32.
Developers usually need this tool to check what a 2FA secret contains, convert a hex key into the Base32 an authenticator expects, or debug an identifier that uses the RFC 4648 alphabet.
How to use it
- Pick Encode or Decode.
- When encoding, choose whether the input is Text (UTF-8) or Hex bytes, and whether to Add = padding.
- Type or paste into the input box; the output updates as you type.
- When decoding, tick Show decoded bytes as hex to see raw bytes. Binary results switch to hex automatically.
- Copy the result, or use Swap & flip mode to feed it back for a round trip.
Worked examples
The RFC 4648 test vectors show how padding fills each 8-character block:
f → MY====== foo → MZXW6=== fooba → MZXW6YTB foobar → MZXW6YTBOI======
Decoding the sample 2FA secret JBSWY3DPEHPK3PXP gives 10 bytes:
48 65 6c 6c 6f 21 de ad be ef
The first six bytes spell Hello! but the last four are not valid UTF-8, so the tool shows hex rather than broken text. Entering mzxw6 === in lower case with a space still decodes to foo.
How Base32 works and what the options mean
The encoder reads the input as a stream of bits and cuts it into 5-bit groups (2⁵ = 32), mapping each group to one symbol. Five bytes (40 bits) become exactly eight characters. A shorter final block is filled with zero bits and then padded with = to eight characters.
- Text (UTF-8) encodes the characters you type as UTF-8 bytes;
éis two bytes. Hex bytes reads pairs of hex digits (spaces, colons and dashes are ignored) — use it for keys. - Add = padding follows RFC 4648 exactly. Untick it for
otpauth://URIs and other places that drop padding. - The byte count next to the output title tells you the size of the data. TOTP secrets are typically 10, 16 or 20 bytes.
Limitations
Only the standard RFC 4648 alphabet is supported. The "base32hex" variant (0–9, A–V), Crockford's Base32 and z-base-32 use different alphabets and will either fail or decode to different bytes. Input is limited to five million characters. This page does not generate one-time codes; it only converts the secret.
Tips and common mistakes
- An error about the digit
0or1almost always means the letter O or I was mistyped. The error message names the position. - A "truncated" error means characters are missing — a block can only end after 2, 4, 5, 7 or 8 symbols.
- Treat real 2FA secrets like passwords: anyone with the secret can generate your codes. Use this page offline or with test secrets when possible.
- For general binary-to-text needs, Base64 is shorter; to inspect other numeric representations, see the number base converter.
Frequently Asked Questions
Which characters does Base32 use?
Standard Base32 (RFC 4648) uses the 26 letters A–Z and the digits 2–7, plus = for padding. The digits 0, 1, 8 and 9 are left out so they cannot be mistaken for the letters O, I/L and B.
Where is Base32 used?
Most often for TOTP/HOTP two-factor secrets (the key behind Google Authenticator and similar apps), Tor onion addresses and some content identifiers. It is chosen where people may need to read or type the value, or where the system is case-insensitive.
Why does my decoded 2FA secret look like gibberish?
A TOTP secret is random key material, not text, so it is not valid UTF-8. The tool detects this and shows the decoded bytes as hex, which is the form most libraries and hardware tokens expect.
Do I need the = padding?
RFC 4648 pads the output to a multiple of 8 characters, but many systems (including otpauth:// URIs) omit it. Untick Add = padding to drop it; the decoder accepts input with or without padding, in upper or lower case, with spaces or line breaks.
How is Base32 different from Base64?
Base32 has a smaller, case-insensitive alphabet with no punctuation, so output is longer: 5 bytes become 8 characters (60% overhead) versus 3 bytes to 4 characters (about 33%) in Base64.
Is my data sent to a server?
No. Encoding and decoding are done by JavaScript in your browser. Nothing you type, including 2FA secrets, is uploaded.
Related tools
- Base64 Encoder/DecoderEncode and decode Base64 strings online
- JWT Decoder & ValidatorDecode JSON Web Tokens (JWT) and inspect their header, payload, claims, and expiry status.
- URL Encoder / DecoderEncode or decode URLs and query string parameters using percent-encoding (RFC 3986).
- Image to Base64Convert images to Base64 encoded strings
- Base64 to Image DecoderDecode Base64 strings back to images. Preview the image live and download it as PNG, JPEG, or WebP.
- HTML Entities EncoderEncode and decode HTML entities
Found a bug or a wrong result? Report it.