Base64 to Hex Converter

Base64 and hexadecimal are both ways to write raw bytes as printable ASCII, but they hide different detail. Hex shows you every byte cleanly in two digits; Base64 is denser but harder to read. Converting from Base64 to hex is what you do when you are debugging a token, inspecting a key fingerprint, or comparing byte sequences across tools that prefer different encodings.

How the conversion works

  1. 1

    Paste the Base64 string

    Works with standard, URL-safe and padded or unpadded Base64.

  2. 2

    The string is decoded to raw bytes

    Each 4 Base64 characters become 3 bytes.

  3. 3

    Each byte is expressed as two hex digits

    Choose uppercase or lowercase output.

  4. 4

    Read the hex

    Optionally with spaces, `0x` prefixes or continuous.

Worked example

Base64 SGVsbG8= decodes to 5 bytes:

Base64 chars Bytes Hex
SGVs 48 65 6C 48 65 6C
bG8= 6C 6F 6C 6F

So SGVsbG8= in hex is 48 65 6C 6C 6F (the ASCII for Hello).

When hex tells you more than Base64

  • Certificate fingerprints — SHA-1 and SHA-256 fingerprints are canonically shown in hex with colons: AB:CD:.... Converting a Base64-encoded hash to hex lets you match it byte-for-byte.
  • Key material — AES keys, HMAC secrets, Ed25519 private keys are usually logged in hex. Same key in Base64 looks completely different; converting lets you verify it is the same.
  • JWT signatures — The signature segment of a JWT is URL-safe Base64. Converting to hex makes it trivial to compare against an expected value in a debug log.
  • TLS session IDs / handshake data — Wireshark shows them in hex; your application may log them in Base64.

Output format options

Base64:       SGVsbG8=
Hex (raw):    48656C6C6F
Hex (spaced): 48 65 6C 6C 6F
Hex (0x):     0x48 0x65 0x6C 0x6C 0x6F
Hex (colons): 48:65:6C:6C:6F
Hex (C):      \x48\x65\x6C\x6C\x6F

Common gotchas

  • URL-safe Base64 — If input contains - or _, it is the URL-safe variant. This tool accepts both automatically.
  • Padding — Accept Base64 with or without trailing =. Decoders usually tolerate it.
  • Whitespace in pasted input — Line breaks and spaces are stripped before decoding.

Frequently Asked Questions

Yes, significantly. Hex uses 2 characters per byte; Base64 uses about 1.33. So hex is 50% longer than Base64, but every byte is clearly visible in hex and the encoding is case-insensitive.

Yes — use the Hex to Base64 Converter. The byte sequence is preserved in either direction; only the textual representation changes.

Either the input was not actually Base64, had characters from a different alphabet (Crockford Base32, Base58), or was truncated. Check the source; try decoding as raw text first to see if it looks meaningful.

Yes. Both hex and Base64 are round-trip representations of bytes; converting between them preserves the byte sequence exactly.

Related Tools