HEX to Base64 Converter

HEX to Base64 Converter - Encode Hexadecimal to Base64 Online

This online HEX to Base64 converter encodes hexadecimal data into Base64 directly in your browser with support for plain, dashed, 0x-prefixed, colon-separated and space-separated HEX input.

Quickly convert hexadecimal to Base64 with standard, URL-safe or 76-character line-break output — no uploads, no tracking, no server round-trip.

Input HEX

Base64 Output

What is HEX to Base64 conversion

HEX to Base64 conversion transforms a hexadecimal string — a base-16 representation of raw bytes — into Base64, a compact ASCII encoding defined by RFC 4648. HEX uses two characters (0-9, A-F) per byte, while Base64 packs every 3 bytes into 4 printable characters, making it roughly 33% shorter than HEX for the same data.

This converter accepts HEX in plain, dashed (DE-AD-BE-EF), 0x-prefixed (0xDE 0xAD), colon-separated (DE:AD:BE:EF) and space-separated forms, then emits standard Base64, URL-safe Base64 or MIME-formatted Base64 with 76-character line breaks.

Why convert HEX to Base64

HEX is excellent for inspection and debugging, but it is bulky and not URL- or form-friendly. Base64 is the standard when you need to embed binary data in text-only channels.

  • Compactness: Base64 is ~25% shorter than HEX for the same bytes.
  • Transport safety: Safe in JSON, XML, YAML, email (MIME) and HTTP headers.
  • Data URIs:data:image/png;base64,… needs Base64, not HEX.
  • URL-safe variant: Replace +// with -/_ for query strings and JWTs.

How to convert HEX to Base64 online (step-by-step)

  1. Paste your HEX into the Input HEX editor, or click Sample to load an example.
  2. The tool auto-detects separators (spaces, dashes, colons, 0x) and normalizes the hex to contiguous bytes.
  3. Pick the desired Base64 flavor in Format: Standard, URL Safe, or With Line Breaks (76 chars).
  4. Read the result in the Base64 Output editor on the right.
  5. Click Copy to place the Base64 on your clipboard, or Download to save it as a .txt file.

Why choose our HEX to Base64 tool

Built for developers, security researchers and power users who want a reliable HEX to Base64 encoder with zero server overhead.

  • 100% client-side: conversion runs in your browser using native btoa() — your data never leaves the tab.
  • Flexible input: accepts the five most common HEX formats without preprocessing.
  • Three output flavors: Standard, URL-safe and line-wrapped MIME Base64.
  • Monaco editor: syntax-friendly editing, fullscreen mode, paste and clear shortcuts.
  • Remembers your choice: preferred output format is stored in local storage for next time.

How HEX to Base64 conversion works

Internally the converter performs three deterministic steps:

  1. Normalize HEX: strip whitespace, dashes, colons and 0x prefixes, leaving only [0-9A-Fa-f]. Odd-length input is left-padded with a leading zero.
  2. Parse hex pairs → byte array: every two hex characters are parsed with parseInt(hex, 16) into a Uint8Array.
  3. Encode bytes → Base64: the byte array is turned into a binary string and passed to btoa(). The selected formatter then produces Standard, URL-safe or 76-character line-wrapped output.

Example: 48656C6C6F20576F726C64 → bytes [48 65 6C 6C 6F 20 57 6F 72 6C 64]SGVsbG8gV29ybGQ=.

Features

  • Accepts plain, dashed, 0x-prefixed, colon-separated and space-separated HEX.
  • Three Base64 output flavors: Standard, URL Safe, and With Line Breaks (76 chars, MIME-style).
  • One-click Sample, Paste from clipboard, and Clear.
  • Copy to clipboard and Download as a .txt file.
  • Fullscreen editor with Esc to exit.
  • Automatic theme switching (light / dark) for the Monaco editor.
  • Persistent format preference via localStorage.

Common use cases

  • Cryptography: convert hex-encoded keys, hashes (SHA-256, MD5) or signatures into Base64 for storage and transport.
  • API tokens & JWT: re-encode hex payload bytes as URL-safe Base64 for header/query usage.
  • Embedding binary in JSON/XML: JSON forbids raw bytes — Base64 is the canonical workaround.
  • Forensics & reverse engineering: move raw memory dumps or PCAP bytes from HEX viewers into Base64 for tools that expect it.
  • Web development: build data: URIs for inline images, fonts or icons.
  • Email (MIME): produce line-wrapped Base64 ready for SMTP bodies and attachments.

Is it safe to use online

Yes. This converter is fully client-side: the HEX you paste never leaves your browser. There is no upload, no logging, no analytics on the input — the encoding runs in JavaScript using the native btoa() API. You can safely use it for secrets, cryptographic material and internal data.

For maximum paranoia you can disconnect from the network after the page loads; the tool will keep working because all code is already in the browser.

Why choose DevTools

DevTools is a curated collection of fast, privacy-respecting browser utilities for developers. Every tool, including this HEX to Base64 encoder, follows the same rules: no ads, no accounts, no tracking of input, and no server-side processing.

  • Open in a modern browser — works offline after first load.
  • Consistent UX across encoding, formatting and conversion tools.
  • Keyboard-friendly Monaco editors with dark/light theming.
  • Clear preference persistence via local storage, nothing cloud-synced.

Download & Copy options and related tools

Use the toolbar above the Base64 output to Copy the result to your clipboard or Download it as a plain-text file (base64-output.txt). Need the reverse direction or a different encoding? Check out these related converters:

FAQ

Is this HEX to Base64 converter free?

Yes, it's completely free with no registration, ads, or usage limits.

What happens if my HEX is invalid?

The tool validates the input against [0-9A-Fa-f] after stripping separators. If non-hex characters are found, an error toast appears and the output shows Error: Invalid hexadecimal input.

What if my HEX string has an odd number of characters?

A single leading 0 is automatically prepended so the string can be split into whole bytes before Base64 encoding.

Does it support URL-safe Base64?

Yes. Pick URL Safe from the format dropdown — + becomes - and / becomes _, compatible with JWTs and query strings.

Is there a maximum input size?

There is no hard-coded limit, but since everything happens in the browser, performance depends on your device. Multi-megabyte HEX inputs are handled comfortably on modern machines.

Is it safe to paste sensitive hex data?

Yes — all encoding runs locally in your browser, nothing is sent to a server. You can even use it offline after the page has loaded.

Can I convert Base64 back to HEX?

Yes — use the reverse tool: Base64 to HEX converter.

Encoding Learning Resources

To deepen your understanding of HEX, Base64 and browser encoding APIs, here are curated external resources: