Base32 to Hex Converter

Paste your Base32 string into the Base32 Input field and the Base32 to Hex Converter decodes it back to its original raw bytes. Click Convert and the hex value appears in Hex Output — turn on uppercase or grouped-bytes formatting if that's easier for you to read. Enter your UIColor's red, green, and blue floats into the uicolor to hex converter to get the matching hex code for use anywhere outside Xcode.

How the Base32 to Hex Converter Decodes Your Data

Step-by-Step: From Base32 Characters to Hex Bytes

Decoding Base32 to hex is a matter of reversing the standard RFC 4648 encoding, one character at a time: Enter your hex number into the hex to base36 converter to get its compact Base36 equivalent, distinct from a byte-encoding scheme like Base64.

  1. Normalize the input. Base32 decoding is case-insensitive, so lowercase letters are treated the same as uppercase, and any trailing = padding characters are stripped before decoding.
  2. Look up each character's 5-bit value. The RFC 4648 alphabet is A–Z (values 0–25) followed by 2–7 (values 26–31) — the digits 0, 1, 8, and 9 are deliberately left out because they're easy to confuse with letters like O, I, and B.
  3. Concatenate the bits. Every character contributes exactly 5 bits, so a run of Base32 characters becomes one long bitstream.
  4. Slice the bitstream into 8-bit bytes. Any leftover bits at the end (from padding) are discarded, since Base32 pads a partial byte group up to a character boundary rather than a byte boundary.
  5. Render each byte as two hex digits. The result is the exact byte sequence the Base32 string was originally encoding.

This is exactly how a Base32-encoded TOTP secret, a file fingerprint, or any other byte-oriented Base32 value turns back into the hex bytes you started with.

Uppercase and Grouped-Byte Output

Once the Base32 to hex conversion runs, two checkboxes above the output let you control how the hex is displayed — nothing about the decoding itself changes, just the formatting:

  • Uppercase — renders the hex digits as A–F instead of the default lowercase a–f.
  • Group bytes — inserts a space between each byte pair (e.g. 68 65 6c 6c 6f instead of 68656c6c6f), which makes longer outputs easier to scan visually.

These are the only two output options this tool exposes — there's no separate decoder mode or alphabet selector, because the decoder only implements one alphabet (see below).

Infographic showing how to convert Base32 JBUQ==== to hex: look up each character's 5-bit value, merge the bits, and regroup into 8-bit bytes to get hex 4869
Base32 to Hex Converter: JBUQ==== = 48 69

Understanding Base32 and Why It Gets Used

What Base32 Is For

Base32 (RFC 4648) represents arbitrary binary data as plain text using a 32-symbol alphabet, at a cost of roughly 1.6 bytes of text per byte of data. Compared to hex, which needs 2 characters per byte, Base32 is more compact; compared to Base64, it avoids mixed-case letters and punctuation entirely, which is why it shows up so often in places meant to be typed or read by a person — TOTP/2FA secret keys, license keys, and some filesystem or DNS-safe identifiers among them. The cmyk to hex converter converts cyan, magenta, yellow, and key percentages from the print color model into a screen-ready hex code.

  • Case-insensitive by design, so it survives being retyped from a printed page or read aloud.
  • No punctuation in the alphabet, which keeps it safe to embed in URLs, filenames, and QR codes without escaping.
  • Padded with = to a multiple of 8 characters, matching every 40 bits (5 bytes) of source data.

Standard RFC 4648 Base32 — and Why Other Variants Aren't Supported Here

There's more than one "Base32" in the wild. Base32hex (used in some DNSSEC records) keeps the alphabet in numeric-then-alphabetic order instead of RFC 4648's alphabetic-then-numeric order, and Crockford's Base32 uses a different symbol set again, along with its own rules for tolerating misread characters like O/0 and I/1/L. Both exist as documented, real encoding schemes — but this converter decodes standard RFC 4648 Base32 only. If you have a Base32hex or Crockford-encoded string, feeding it through this tool will either throw an invalid-character error or (for characters the two alphabets happen to share) silently produce the wrong bytes, since the character-to-value mapping is different.

Common Reasons to Decode Base32 to Hex

  • TOTP and HOTP secrets. Authenticator apps store their shared secret as Base32; decoding it to hex is a common first step when debugging or re-provisioning a 2FA setup.
  • File and protocol formats. Some file formats and network protocols embed identifiers or checksums as Base32 text that's easier to move around as hex once decoded, for indexing or comparison.
  • Cross-checking an encoder. If you're writing your own Base32 encoder, decoding its output back to hex with an independent tool is a fast way to confirm the bytes round-trip correctly.

Worked Examples: Decoding Base32 to Hex by Hand

Example 1: A Short String

Decode MFRGG=== (5 real characters plus 3 padding characters) to hex:

  1. Input: MFRGG=== → strip padding → MFRGG
  2. Look up each character's 5-bit value (A=0 ... Z=25, 2=26 ... 7=31):
    M=01100, F=00101, R=10001, G=00110, G=00110
  3. Concatenate: 0110000101100010011000110 (25 bits)
  4. Keep only whole bytes: 25 bits gives 3 full bytes (24 bits); the last leftover bit is discarded — 011000010110001001100011 becomes 01100001 01100010 01100011
  5. Convert each byte to hex: 61 62 63
  6. Result: 616263 — the ASCII bytes for “abc”.

Example 2: A Longer String

Decode NBSWY3DPEB3W64TMMQ======:

  1. Strip padding, decode each character to its 5-bit value, and concatenate the full bitstream, same as above.
  2. Slice into whole bytes, discarding leftover padding bits.
  3. Result: 68656c6c6f20776f726c64 — the ASCII bytes for “hello world”.

Longer TOTP secrets decode the same way, just with more characters and more resulting bytes — the algorithm doesn't change with input length.

Sample Code: JavaScript and Python

Both snippets below implement the same standard RFC 4648 decode and were checked against the examples above.

JavaScript
function base32ToHex(input) {
  const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
  let bits = '';
  let hex = '';
  input = input.replace(/=/g, '').toUpperCase();
  for (let i = 0; i < input.length; i++) {
    const val = alphabet.indexOf(input.charAt(i));
    if (val === -1) throw new Error('Invalid Base32 character');
    bits += val.toString(2).padStart(5, '0');
  }
  for (let i = 0; i + 8 <= bits.length; i += 8) {
    hex += parseInt(bits.substring(i, i + 8), 2).toString(16).padStart(2, '0');
  }
  return hex;
}
// base32ToHex('MFRGG===')  -> '616263'
Python
import base64

def base32_to_hex(base32_str):
    raw = base64.b32decode(base32_str.upper())
    return raw.hex()

# base32_to_hex('MFRGG===') -> '616263'

Frequently Asked Questions

Does this tool send my data anywhere?

No. The Base32 to hex converter runs entirely client-side in your browser's JavaScript — the Base32 string you paste in is never sent to a server.

Is Base32 decoding case-sensitive?

No. Lowercase letters are normalized to uppercase before decoding, so mfrgg=== and MFRGG=== both decode to the same hex output.

Can this tool decode Base32hex or Crockford's Base32?

No — this converter implements standard RFC 4648 Base32 only. Base32hex and Crockford's Base32 use different character-to-value mappings, so decoding one of those strings here won't produce correct results.

What if my Base32 string is missing its padding characters?

That's fine — the decoder strips any trailing = characters before processing, so a string with partial or no padding decodes the same as one with full padding, as long as the underlying characters are valid.

What libraries can I use to decode Base32 in my own code?

  • Python: the standard-library base64 module (base64.b32decode).
  • JavaScript: no built-in function, but the decode is short enough to hand-roll (see the sample above) or pull from an npm package.
  • Java: Apache Commons Codec's Base32 class implements the same RFC 4648 alphabet.