TFT

Hex to Base64 Encoder and Decoder

Encode hex data to Base64 for web transmission, or decode Base64 back to hex. Supports URL-safe encoding. A versatile tool for web developers and data serialization tasks.

Hex to Base64 Encoder/Decoder

Encode hexadecimal strings to Base64 and decode Base64 to hex

Examples

Hex → Base64
48656C6C6F → SGVsbG8=
Base64 → Hex
SGVsbG8= → 48656C6C6F

How it works

Enter hexadecimal data in the input field. For encoding, the hex is first converted to binary bytes, then encoded to Base64 using the standard Base64 alphabet (A-Z, a-z, 0-9, +, /).

For decoding, Base64 input is converted back to binary, then displayed as hex. The tool automatically detects input format and offers the appropriate conversion direction.

Both URL-safe Base64 (using - and _ instead of + and /) and standard Base64 are supported. Padding with = signs is handled automatically. Copy results with a single click.

When You'd Actually Use This

API Data Transfer

Encode binary data as Base64 for JSON APIs that don't support raw binary in request bodies.

Image Embedding

Convert image hex data to Base64 for embedding directly in HTML or CSS as data URIs.

Cryptographic Keys

Encode/decode encryption keys and certificates between hex and Base64 formats.

Data Storage

Store binary data in text-only databases or configuration files using Base64 encoding.

Email Attachments

Understand how binary attachments are encoded for email transmission (MIME Base64).

CTF Challenges

Decode Base64-encoded flags and data in cybersecurity competitions.

What to Know Before Using

Base64 encoding: Every 3 bytes (24 bits) become 4 Base64 characters (6 bits each). Padding (=) is added if input isn't divisible by 3.

Size expansion: Base64 is ~33% larger than original binary. Hex is 2x larger. Base64 is more compact than hex for binary data.

URL-safe variant: Standard Base64 uses + and / which aren't URL-safe. URL-safe Base64 uses - and _ instead.

Padding: Base64 may end with = or == for padding. Some systems omit padding; this tool handles both cases.

Case sensitivity: Base64 is case-sensitive. ABC differs from abc. Hex input is case-insensitive.

Common Questions

What is 0x48656C6C6F in Base64?

0x48656C6C6F ("Hello") encodes to SGVsbG8= in Base64. The = is padding since 5 bytes isn't divisible by 3.

How do I decode Base64 to hex?

Paste the Base64 string and select decode. The tool converts Base64→binary→hex, showing the original hex representation.

Why does Base64 have equals signs?

= is padding to make the output length divisible by 4. One = means 2 bytes of input, two = means 1 byte.

What's URL-safe Base64?

URL-safe Base64 replaces + with - and / with _ so the encoded string can be used in URLs without percent-encoding.

Can I encode images to Base64?

Yes. Convert image file to hex first, then encode to Base64. The result can be used in data:image/png;base64,... URIs.

Is Base64 encryption?

No. Base64 is encoding, not encryption. It's easily reversible and provides no security. Use encryption for sensitive data.

What's the Base64 for empty data?

Empty input produces empty output. No padding is needed for zero bytes.