Base64 to Hex Converter
Decode a Base64 string — like a data URI, JWT segment, or email attachment payload — back into its raw hex bytes.
How Base64 to Hex Decoding Works
Reverse the encoding process: look up each Base64 character's 6-bit value, concatenate all the bits into one long string, then split that into 8-bit bytes and write each as 2 hex digits. Any = padding is dropped first since it carries no data.
Base64 to Hex Example, Step by Step
SGVsbG8= = 48656C6C6F
SGVsbG8= (Base64) = 48656C6C6F (hex, the ASCII text "Hello")
SGVsbG8= has 7 real characters + 1 padding 7 x 6 bits = 42 bits, trimmed to the 40 usable 40 bits / 8 = exactly 5 bytes
| Step | Description | Result |
|---|---|---|
| Decode each character | look up each character's 6-bit value, skip the = padding | bit string |
| Regroup into bytes | split the bits into 8-bit bytes | 5 bytes |
| Write as hex | each byte becomes 2 hex digits | 48656C6C6F |
This decodes back to the exact same bytes used in the Hex to Base64 example — encoding and decoding are inverses of each other.
Common Mistakes When Decoding Base64
- Feeding in URL-safe Base64 (with - and _) without converting those characters back to + and / first.
- Forgetting the input length must be a multiple of 4 characters, including any = padding.
- Confusing this with decoding Base32, which uses a different alphabet and bit width per character.
Frequently Asked Questions
How do you decode Base64 back to hex?
Map each Base64 character back to its 6-bit value, concatenate all the bits, then regroup them into 8-bit bytes and write each byte as 2 hex digits.
Why would I decode Base64 to hex?
To inspect the raw bytes inside a JWT payload segment, verify what a data URI actually encodes, or feed decoded binary data into hex-based tooling.
What do the = characters at the end mean?
Padding, added during encoding so the output length is a multiple of 4 — they're stripped automatically before decoding and carry no data of their own.
Does this handle URL-safe Base64 (with - and _)?
This decoder expects standard Base64 (+ and /) — if your input uses URL-safe characters, replace - with + and _ with / first.
What happens if I enter an invalid Base64 string?
The calculator flags it — valid Base64 only uses A-Z, a-z, 0-9, +, and / (plus = padding), and its length must be a multiple of 4 characters.
Is this the same as decoding Base32?
No — they use different alphabets and different bit-grouping (6 bits per character for Base64, 5 bits for Base32), so a Base32 string can't be decoded with this tool.