Base64 to HEX Converter

Convert between Base64 and hexadecimal (HEX) formats. Essential for developers working with binary data, cryptography, and low-level programming.

🔒 Privacy First: All conversion happens locally in your browser. Your data never leaves your device.
Length: characters

What is HEX (Hexadecimal)?

Hexadecimal (HEX) is a base-16 numbering system that represents binary data using 16 symbols: 0-9 and A-F. Each HEX digit encodes exactly 4 bits. Two HEX digits represent one byte, producing values from 00 to FF (0 to 255 in decimal).

HEX is the standard representation for memory addresses, MAC addresses, cryptographic hashes, and CSS color codes. Developers use HEX because it maps directly to binary in fixed-width groups. For example, the byte 11111111 in binary equals FF in HEX. This 4-bit alignment makes HEX far more readable than decimal for byte-level work.

What Are the Common Use Cases for Base64 to HEX Conversion?

Base64 to HEX conversion is used when binary data encoded for transport needs to be inspected or compared at the byte level. This applies to cryptographic hashes, binary protocol debugging, and low-level data analysis.

Hash verification: SHA-256 and MD5 hashes are often delivered in Base64 (e.g., in HTTP headers and JWTs) but displayed as HEX in checksum files. Converting a Base64-encoded SHA-256 hash produces a 64-character HEX string. You can validate Base64 strings before converting.

Binary protocol debugging: Network packet captures and binary file headers are easier to analyze in HEX. Each byte maps to exactly 2 HEX characters, making byte boundaries visible. Use the file encoder to first encode files to Base64, then convert to HEX for inspection.

Cryptographic key inspection: TLS certificates, AES keys, and HMAC secrets are stored as Base64 in PEM files and APIs. Converting to HEX reveals the exact byte values for comparison or debugging.

Embedded systems: Firmware images and memory dumps use HEX (Intel HEX, Motorola S-record). Converting Base64-encoded payloads to HEX enables direct comparison with device memory.

How Does Base64 to HEX Conversion Work?

Base64 to HEX conversion is a two-step process: decode the Base64 string to raw bytes, then represent each byte as 2 hexadecimal characters. The reverse converts HEX pairs to bytes and encodes them as Base64 per RFC 4648.

Base64 to HEX: The tool decodes the Base64 input using the standard alphabet defined in RFC 4648 (A-Z, a-z, 0-9, +, /). Each resulting byte is converted to its 2-digit hexadecimal value (00 through FF). For example, AQID decodes to 3 bytes and produces 010203.

HEX to Base64: The tool reads pairs of HEX digits, converts each pair to a single byte (0-255), then encodes all bytes using Base64. The input 48656C6C6F (5 bytes) produces the Base64 string SGVsbG8=. You can then encode text to Base64 directly if you need text-based encoding instead.

What HEX Input Formats Are Supported?

This tool accepts HEX strings in multiple formats: continuous (48656C6C6F), colon-separated (48:65:6C:6C:6F), and space-separated (48 65 6C 6C 6F). Separators are stripped automatically before conversion.

Both uppercase (A-F) and lowercase (a-f) HEX digits are accepted. The input must contain an even number of HEX characters after separators are removed. Output is always uppercase without separators. For Base64 input, standard and URL-safe Base64 variants are both supported via the URL-safe Base64 encoder.

How Do Base64 and HEX Compare?

Base64 and HEX are both text-based encodings for binary data, but they differ in character set size, output length, and typical use cases. Base64 is more compact; HEX is more readable at the byte level.

PropertyBase64Hexadecimal (HEX)
Base64 (6 bits per character)16 (4 bits per character)
Character SetA-Z a-z 0-9 + /0-9 A-F
Size Ratio33% larger than binary100% larger than binary
Common UseData URIs, APIs, emailDebugging, crypto hashes, memory
Example (3 bytes)AQID (4 chars)010203 (6 chars)

A 32-byte SHA-256 hash produces 44 Base64 characters (with padding) but 64 HEX characters. For bandwidth-sensitive contexts like JSON APIs and email attachments, Base64 is preferred. For human-readable debugging and checksum display, HEX is standard. Explore all Base64 tools for additional encoding and decoding options.

Is This Base64 HEX Converter Private?

Yes. All conversions execute entirely in your browser using JavaScript. No data is transmitted to any server. Your Base64 strings, HEX values, cryptographic keys, and hashes never leave your device.

The tool uses the browser's native atob() and btoa() functions for Base64 decoding and encoding. No third-party libraries process your data. This makes the tool safe for converting sensitive material such as private keys, authentication tokens, and encrypted payloads.

Frequently Asked Questions

What is the difference between Base64 and hexadecimal?

Base64 uses a 64-character alphabet and encodes 6 bits per character, producing output that is 33% larger than the original binary. Hexadecimal uses a 16-character alphabet (0-9, A-F) and encodes 4 bits per character, producing output that is 100% larger than binary. For a 32-byte input, Base64 outputs 44 characters while HEX outputs 64 characters. Base64 is defined in RFC 4648.

How do I convert an SHA-256 hash from Base64 to HEX?

Paste the Base64-encoded SHA-256 hash into the input field and click "Base64 to HEX." The tool decodes the 32-byte hash and outputs 64 hexadecimal characters. SHA-256 hashes in HTTP Digest headers and Subresource Integrity (integrity) attributes use Base64, while checksum files and blockchain explorers display them in HEX.

Why is HEX output longer than Base64?

HEX encodes 4 bits per character. Base64 encodes 6 bits per character. For the same binary data, HEX needs 2 characters per byte while Base64 needs approximately 1.33 characters per byte. Specifically, n bytes produce 2n HEX characters and ceil(4n/3) Base64 characters. The 50% size difference makes Base64 more efficient for data transport.

Can I convert HEX color codes with this tool?

Yes. Enter a HEX color code without the # prefix. For example, entering FF5733 and clicking "HEX to Base64" converts the 3-byte color value to its Base64 equivalent (/1cz). The tool handles 3-byte RGB codes (6 HEX characters) and 4-byte RGBA codes (8 HEX characters). Both uppercase and lowercase HEX digits are accepted.