Base64 to Hex Converter
Decode a Base64 string into its raw bytes as hexadecimal - missing padding is tolerated, whitespace is ignored.
5 bytes decoded
As UTF-8 text: Hello
How to Convert Base64 to Hex
Base64 packs three bytes into four characters, so decoding back to hex is just regrouping:
- Split the Base64 into groups of four characters
- Map each character back to its 6-bit value (A=0 through Z=25, a=26 through z=51, 0=52 through 9=61, +=62, /=63)
- Concatenate each group's 24 bits and split them into three bytes
- Write every byte as two hex digits
Example: Decode SGVsbG8=:
- S(18) G(6) V(21) s(44) → 010010 000110 010101 101100 → 48 65 6C
- b(27) G(6) 8(60) = → 011011 000110 111100 → 6C 6F
- Result: 48 65 6C 6C 6F - the bytes of "Hello"
Code Examples
const b64 = "SGVsbG8=";
const bytes = Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
[...bytes].map((b) => b.toString(16).padStart(2, "0")).join(" ");
// "48 65 6c 6c 6f"Frequently Asked Questions
How do I convert Base64 to hex?
Every four Base64 characters encode three bytes; decode those back to bytes, then write each byte as two hex digits. SGVsbG8= decodes to the bytes for Hello, which are 48 65 6C 6C 6F in hex.
What if my Base64 has no = padding?
Padding is optional here - the decoder works it out from the length. SGVsbG8 and SGVsbG8= give identical results. Padding that appears anywhere except the end is rejected as malformed.
Can it decode URL-safe Base64 (- and _)?
Not directly. URL-safe Base64 swaps +/ for -_ and is common in JWTs. Replace - with + and _ with / first; the tool points this out if it sees those characters.
Why decode Base64 to hex at all?
Hex shows the exact underlying bytes, which makes structure visible: magic numbers, embedded lengths, NUL terminators, and non-UTF-8 values that would render as gibberish characters in text output.
Related Tools
Hex to Base64 Converter
Convert hexadecimal bytes to a Base64 string instantly - accepts spaced, comma-separated, 0x-prefixed, or continuous hex.
Hex to Text Converter
Convert hexadecimal bytes into readable ASCII or UTF-8 text instantly.
Text to Hex Converter
Convert text into hexadecimal bytes using UTF-8 encoding instantly.
Bytes to Int Converter
Convert hex bytes to signed or unsigned integers using big-endian or little-endian byte order.
This tool runs entirely in your browser - nothing you enter is uploaded or stored.