Skip to content
Hex Calculator

Base64 to Hex Converter

Decode a Base64 string — like a data URI, JWT segment, or email attachment payload — back into its raw hex bytes.

Hexadecimal result
0x48656C6C6F

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
StepDescriptionResult
Decode each characterlook up each character's 6-bit value, skip the = paddingbit string
Regroup into bytessplit the bits into 8-bit bytes5 bytes
Write as hexeach byte becomes 2 hex digits48656C6C6F

This decodes back to the exact same bytes used in the Hex to Base64 example — encoding and decoding are inverses of each other.

Where Decoding Base64 Actually Comes Up

Inspecting a JWT's Payload

A JWT's header and payload segments are Base64-encoded JSON — decoding a segment to hex (then to text) lets you verify exactly what claims a token actually carries.

JWT segment -> raw JSON bytes

Extracting a Data URI's Raw File Bytes

Images and fonts embedded directly in CSS or HTML as data URIs carry their file content as Base64 — decoding recovers the original binary bytes for inspection.

data:image/png;base64,... -> raw bytes

Verifying an Email Attachment's Encoding

Email systems that transport binary attachments as Base64 sometimes have encoding issues — decoding a suspect attachment to hex helps confirm whether the bytes match the expected file format.

attachment payload -> raw bytes

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.

Why Use This Calculator Instead of Doing It by Hand

  • Handles padding and bit regrouping automatically, no manual bit math
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Flags invalid characters and lengths instead of returning garbage bytes
  • Faster than firing up a REPL just to decode one string

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.

How do I inspect what's inside a JWT payload segment?

Take the middle (payload) segment of the JWT, add back any missing = padding, and decode it here — the resulting hex bytes are the raw JSON payload, which you can then decode further as UTF-8 text.

Can I decode a data URI's Base64 portion with this?

Yes — strip everything up to and including the comma in data:image/png;base64,... and decode just the Base64 portion here to inspect the raw file bytes.