Skip to main content
Preparing workspace

Base64 to Hex

Decode standard or URL-safe Base64 into hex bytes, printed spaced, continuous, as a C array or as a hexdump -C listing with an ASCII gutter.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

Base64 to Hex

Decode Base64 into hexadecimal byte output locally.

Base64 to Hex decodes a Base64 string into its raw bytes and prints those bytes as hexadecimal — two hex digits per byte, so the output is always exactly twice the decoded length. It reads the standard RFC 4648 §4 alphabet as well as URL-safe input using - and _, and can render the result spaced, continuous, as a C array or as a hexdump -C listing with 16 bytes per line and a printable-ASCII gutter. It is for engineers inspecting a binary blob that arrived as text.

How to use Base64 to Hex

  1. Put your payload in the 'Base64 Input' box — type it, press Paste, press Upload .txt (it accepts .txt, .b64 and .base64), drag a file onto the box, or press Sample Data for a ready-made example. The character count sits under the box and Clear empties it.

  2. Auto Convert is ON by default, so the 'Hex Output' panel fills in as you type; switch it off and press Convert to run it by hand. Bad input turns the status pill to Invalid and prints the reason, such as 'Incorrect length — this is not valid Base64.'

  3. Shape the bytes in Advanced Options — 'Uppercase Hex (A-F)', 'Add 0x prefix', 'Group hex pairs' and the grouping menu (No grouping, Pairs (2 chars), Words (4 chars), Blocks (8 chars)) — then press Copy, Download .txt to save base64-to-hex.txt, or Share; Reset clears the input and restores the default options.

Why use Base64 to Hex

  • Exact byte view

    Every byte becomes two hex digits, so the output length confirms the decoded size at a glance.

  • Real hexdump layout

    Offsets are 8 hex digits, 16 bytes per line in two groups of 8, matching hexdump -C output.

  • Precise error messages

    A stray character is reported with its position; a 4n+1 length is flagged as truncation.

Common use cases

  • Check the magic number of a Base64 attachment — 89 50 4E 47 means PNG, 25 50 44 46 means PDF
  • Paste a Base64-encoded key or certificate and read the DER byte structure instead of guessing at it
  • Turn a Base64 test vector into a 0x-prefixed, comma-separated hex list you can drop into a C array initializer

Frequently asked questions

How many hex characters does Base64 decode to?

Exactly 2 per decoded byte. Base64 turns 4 characters into 3 bytes, so 100 Base64 characters become 75 bytes and 150 hex digits. The tool reports both counts so you can verify a payload length without a hex editor.

Link to answer
How do I tell what kind of file a Base64 string holds?

Read the first bytes in hex. 89 50 4E 47 is PNG, FF D8 FF is JPEG, 25 50 44 46 is %PDF, 50 4B 03 04 is a ZIP (so also .docx or .xlsx), and 1F 8B is gzip. The tool shows the first 8 bytes separately for exactly this check.

Link to answer
Does this handle URL-safe Base64?

Yes. URL-safe Base64 (RFC 4648 §5) swaps + for - and / for _, and usually drops the = padding. Both alphabets decode here, and the tool notes when it accepted an unpadded string.

Link to answer
Why does my Base64 string fail to decode?

The most common cause is truncation: a Base64 length of 4n+1 characters cannot exist, because 4 characters carry 3 bytes. The other frequent causes are a stray character copied from a wrapped email header, or `=` padding appearing somewhere other than the end.

Link to answer

Embed this tool on your site

Add the Base64 to Hex widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.

<iframe src="https://www.altftool.com/embed/widget/base64-to-hex"
  title="Base64 to Hex — free AltFTool widget"
  width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
  loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/base64-to-hex?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>

Browse all embeddable widgets →