Skip to main content
Preparing workspace

Hex to Base64

Convert hex to Base64: 4d616e becomes TWFu, a 64-char SHA-256 hex becomes 44 chars. Standard or URL-safe, spaces and 0x allowed, and Base64 back to hex.

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

About this tool

Hex to Base64

Convert hex bytes to standard or URL-safe Base64, or Base64 back to hex, with spaces, colons and 0x prefixes stripped automatically.

To convert hex to Base64, read every two hex digits as one byte, then write each group of three bytes as four Base64 characters (RFC 4648). Hex 4d616e is the bytes 77, 97, 110, which become TWFu. Paste hex with spaces, colons or 0x prefixes; choose standard or URL-safe output, or switch direction to turn Base64 back into hex.

How to use Hex to Base64

  1. Pick a direction — Hex → Base64 or Base64 → Hex — and paste into the box; spaces, colons and 0x prefixes in hex input are stripped before decoding.

  2. For Base64 output tick "URL-safe alphabet (- and _)" or "Keep = padding"; for hex output tick "Uppercase hex" or "Space every byte".

  3. Read the converted string with its byte count, the same data sized as hex and as Base64, how many characters Base64 saves, and the UTF-8 decoding, then press Copy result.

Why use Hex to Base64

  • Handles messy input

    Spaces, colons, dashes and 0x prefixes are stripped before decoding, so hex dumps paste straight in.

  • Both alphabets

    Switch between standard (+ /) and URL-safe (- _) Base64, with padding on or off.

  • Runs offline

    Conversion happens in the browser, so keys and hashes never leave the device.

Common use cases

  • Turn a 64-character SHA-256 hex digest into the 44-character Base64 form an API expects.
  • Convert a colon-separated certificate fingerprint into URL-safe Base64 for a query-free token field.
  • Decode a Base64 string back to hex to compare it byte for byte against a hex value in a log.

Frequently asked questions

How do you convert hex to Base64?

Decode the hex to bytes — two hex digits per byte — then re-encode those bytes in groups of three as four Base64 characters. Hex 4d616e is the three bytes 77, 97, 110, which encode to TWFu.

Link to answer
Why is my Base64 shorter than the hex?

Base64 carries 6 bits per character against hex's 4, so it needs about 33% more characters than raw bytes while hex needs 100% more. A 32-byte hash is 64 hex characters but only 44 Base64 characters including padding.

Link to answer
What do the = signs at the end of Base64 mean?

They pad the output to a multiple of four characters. One leftover byte produces two characters plus '==', two leftover bytes produce three characters plus '='. This tool decodes Base64 with or without the padding, and the Keep = padding toggle controls whether it is written.

Link to answer
What is URL-safe Base64?

The RFC 4648 §5 alphabet, which replaces + with - and / with _ so the string survives being placed in a URL path or query without percent-encoding. The bytes are identical; only two characters differ.

Link to answer
How do I convert Base64 back to hex?

Switch the direction to Base64 → Hex and paste the string; both the standard (+ /) and URL-safe (- _) alphabets are accepted. TWFu decodes to 4d 61 6e. Tick Uppercase hex or Space every byte to match the format of the value you are comparing against.

Link to answer

Embed this tool on your site

Add the Hex to Base64 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/hex-to-base64"
  title="Hex to Base64 — 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/hex-to-base64?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>

Browse all embeddable widgets →