Hex to Base64 Converter

Client-sideNo sign-upFree

Convert a hex string into Base64 by treating each pair of hex digits as one raw byte.

Quick facts

Category
Converters
Best for
Turning a hex-encoded byte sequence (a hash, a binary blob, a hex dump) into Base64 for embedding in text-based formats
Hex input
✓ 5 bytes
Base64
SGVsbG8=
The hex digits are parsed as raw bytes (two hex digits = one byte), then those bytes are Base64-encoded - the hex string's characters are never Base64-encoded directly as text.
In-content slot
Was this tool helpful?
On this page

Overview

Convert a hex string into Base64 by interpreting it as raw bytes - each pair of hex digits (e.g. "48") is one byte, and those bytes are Base64-encoded directly, the same way a hex dump, hash digest, or hex-encoded binary payload would be. This is deliberately different from just Base64-encoding the hex string's own characters as text: "41" as two ASCII characters "4" and "1" would Base64-encode to something else entirely, while "41" as the single byte 0x41 (the letter "A") encodes to "QQ==". Parsing goes through the same `hexToBytes` byte parser used by Hex to UTF-8 Converter, so invalid hex (odd length, non-hex characters) is rejected with the same specific error rather than silently misinterpreted. Runs entirely client-side.

Best for: Turning a hex-encoded byte sequence (a hash, a binary blob, a hex dump) into Base64 for embedding in text-based formats

How to use this tool

  1. Paste your hex string. A contiguous hex string, e.g. 48656c6c6f - optional spaces or a 0x prefix are stripped.
  2. Hex is parsed into raw bytes. Each pair of hex digits becomes exactly one byte (0-255).
  3. Bytes are Base64-encoded. The byte array (not the hex text) is what gets Base64-encoded.

Frequently asked questions

"41" is parsed as hex, meaning it represents one byte: 0x41, which is 65 in decimal - the ASCII/UTF-8 byte for the letter "A". Base64-encoding that single byte produces "QQ==". If the two characters "4" and "1" were instead Base64-encoded as plain text, the result would be different and wrong for this tool's purpose.

Anything containing non-hex characters, and any hex string with an odd number of digits (since two hex digits are required to form one complete byte) - each produces a specific error message rather than a partial or guessed result.

Base64 Encoder/Decoder takes plain text and Base64-encodes its UTF-8 bytes. This tool takes a hex string representing arbitrary bytes (which may not be valid UTF-8 text at all, like a hash digest) and Base64-encodes those bytes directly.

Explore more free tools

Formatters, converters, validators, and generators - all free and running entirely in your browser.

Browse more tools