Главная Hex to Base64

Hex to Base64

Convert hexadecimal strings into a Base64 string — 100% in your browser.

Input

Output

What is Hex?

Hexadecimal, usually shortened to "hex", is a base-16 number system that uses the digits 0–9 and the letters A–F to represent the values 10–15. In computing, hex is the most common way to write raw bytes because every byte (0–255) fits into exactly two hex digits — for example, the byte 255 becomes FF and the byte 72 becomes 48. Hex strings are often prefixed with 0x (e.g. 0x4A6F) to make the base explicit, and they appear everywhere from assembly listings and memory dumps to cryptographic fingerprints and CSS color codes.

Because each hex digit represents 4 bits, a pair of hex digits always represents exactly one byte. This makes hex a compact, unambiguous and human-readable way to inspect and exchange binary data — you can read it, copy it, paste it into a chat or a ticket, and another developer will receive the exact same bytes.

What is Base64?

Base64 is an encoding scheme that represents binary data using 64 printable ASCII characters — the uppercase letters A–Z, lowercase a–z, digits 0–9, plus the symbols "+" and "/", with "=" used for padding. Because the output uses only safe ASCII characters, Base64 can travel through systems that would otherwise mangle or reject raw binary data: email bodies, JSON fields, HTTP headers, URLs and database text columns.

Base64 works by taking the input bytes three at a time (24 bits) and splitting them into four groups of 6 bits, each of which is looked up in the 64-character alphabet. The encoded output is therefore always a multiple of four characters and is roughly 33% longer than the original bytes.

Hex vs Base64

Hex and Base64 both encode binary data as text, but they differ in density and purpose. Hex uses 16 characters (0–9, A–F) and produces an output twice as long as the input — two hex characters per byte. Base64 uses 64 characters and produces an output about 33% longer than the input — four Base64 characters for every three bytes.

Hex is the better choice when you need to inspect, debug or compare bytes visually, because every byte maps to a fixed two-character pair. Base64 is the better choice when you need to transport bytes through a text-only channel as compactly as possible. Converting from hex to Base64 lets you take data that was stored or shared in a readable hex form and ship it through a system that prefers Base64 — for example, when embedding a key inside a JSON Web Token or pasting a binary blob into an email.

When to convert Hex to Base64

Converting hex to Base64 is useful in several practical scenarios:

  • API payloads. Some APIs accept binary data only as Base64. If your source data is a hex string, convert it before sending.
  • Cryptographic tokens. HMAC outputs, AES keys and IVs are often shared as hex, but JWT and similar formats require Base64URL.
  • Email attachments. Binary content inlined in email bodies must be Base64-encoded; hex sources need conversion first.
  • Data URIs. Small binary blobs inlined in HTML or CSS use Base64, not hex.
  • Database export. Storing a hex value as Base64 can save space when the column is text-only.

Whenever a system accepts Base64 but you only have hex, this converter gives you the correct output instantly.

How to convert Hex to Base64

Converting hex to Base64 with this tool takes a second and happens entirely in your browser. No upload, no sign-up, no installation. Follow these steps:

  1. Paste your hex string. Spaces, newlines and a leading 0x are accepted and stripped automatically.
  2. Click "Convert". The Base64 string appears in the output box. If the input is invalid (odd length or non-hex characters), an error is shown.
  3. Copy the result. Click "Copy" to copy the Base64 string to your clipboard, then paste it where you need it.

Because every step runs locally with JavaScript, your data never leaves your browser. This makes the tool safe for keys, tokens and other confidential bytes.

Is this Hex to Base64 converter free?

Yes, completely free with no sign-up, no watermarks and no limits beyond your device's memory.

Does it accept spaces and a 0x prefix?

Yes. Whitespace, newlines and a leading 0x are stripped automatically before decoding.

What if the hex string has an odd length?

An even number of hex digits is required (two digits per byte). The tool shows an error if the length is odd or the input contains non-hex characters.

Is my input uploaded?

No. All processing is local. Your hex string never leaves your browser.