PureDevTools

Hex Encoder / Decoder

Convert text to hexadecimal and decode hex back to text

All processing happens in your browser. No data is sent to any server.

Output Options

||

Type or paste text above to see the hexadecimal-encoded result.

You’re staring at a network packet dump — 48 65 6C 6C 6F — and you need to confirm that’s really “Hello”. Or you’re writing a binary protocol parser and need to construct test payloads byte by byte. Or a colleague pasted a hex string in Slack and you need to read it without opening a terminal. This tool converts between text and hexadecimal in both directions, instantly.

What Is Hexadecimal Encoding?

Hexadecimal (base-16) encoding represents each byte of data as two characters from the set 0–9 and A–F. Every byte (0–255) maps to exactly two hex digits (00FF), making hex a compact, unambiguous way to represent binary data in text form.

Text:  Hello
Bytes: 72 101 108 108 111 (decimal)
Hex:   48 65 6C 6C 6F

Hex is not an encoding scheme like Base64 — it’s a numeral system. But “hex encoding” (converting arbitrary bytes to their hex representation) is one of the most fundamental operations in systems programming, networking, and cryptography.

Why Hex Instead of Base64?

Both hex and Base64 represent binary data as text, but they serve different purposes:

PropertyHexBase64
Characters per byte2~1.33
Size overhead100%33%
ReadabilityByte-aligned, easy to parse visuallyCompact but not byte-aligned
Use caseDebugging, protocol specs, low-level workData transport, APIs, email

Hex is preferred when you need to read individual bytes — debugging binary protocols, inspecting file headers, examining hash digests. Base64 is preferred when you need to transport binary data efficiently through text channels.

Common Hex Formats

Hex strings appear in many formats depending on context:

Space-separated (48 65 6C 6C 6F)

The most readable format. Each byte is separated by a space. Standard in packet analyzers (Wireshark), hex dump tools, and hardware documentation.

Continuous (48656C6C6F)

No separators. Common in hash digests (sha256sum output), CSS color codes (#FF5733), and programming contexts where the hex string is parsed programmatically.

0x-prefixed (0x48 0x65 0x6C 0x6C 0x6F)

The 0x prefix marks each value as hexadecimal explicitly. Standard in C, C++, JavaScript, and many programming languages: 0xFF is unambiguously hex, while FF could be confused with a variable name.

Backslash-escaped (\x48\x65\x6C\x6C\x6F)

Used in string literals in C, Python, and other languages to embed raw bytes: "\x48\x65\x6C\x6C\x6F" is “Hello”.

This tool supports all of these formats for both input and output.

Use Cases

Network debugging: Tools like tcpdump and Wireshark display packet payloads in hex. Converting hex to text lets you inspect HTTP headers, DNS queries, or custom protocol messages without writing a parser.

Hash verification: SHA-256 hashes are displayed as 64-character hex strings. Understanding hex helps you verify file integrity: sha256sum file.bin outputs hex, and you compare it character by character.

Color codes: Web colors like #1A2B3C are hex representations of RGB byte values — 1A (red=26), 2B (green=43), 3C (blue=60).

Cryptographic keys and IVs: AES keys, initialization vectors, and nonces are commonly exchanged as hex strings. A 128-bit AES key is 32 hex characters.

Binary file analysis: File format magic bytes are specified in hex. A PNG file starts with 89 50 4E 47 0D 0A 1A 0A. A PDF starts with 25 50 44 46 (%PDF). Hex encoding makes these signatures readable.

Embedded systems: When programming microcontrollers or FPGAs, register values and memory addresses are written in hex. Converting between hex and human-readable values is a daily task.

Hex in Programming Languages

// JavaScript
"Hello".split('').map(c => c.charCodeAt(0).toString(16)).join(' ')
// "48 65 6c 6c 6f"
# Python
"Hello".encode().hex()        # '48656c6c6f'
bytes.fromhex('48656c6c6f')   # b'Hello'
# Command line
echo -n "Hello" | xxd -p    # 48656c6c6f
echo "48656c6c6f" | xxd -r -p  # Hello

UTF-8 and Multi-byte Characters

For ASCII text, each character is one byte and one hex pair. For Unicode text encoded as UTF-8, characters may span multiple bytes:

Text: cafe with accent e
Hex:  63 61 66 C3 A9

The accented e character (U+00E9) is encoded as two UTF-8 bytes: C3 A9. This tool encodes text as UTF-8 before converting to hex, ensuring correct handling of all Unicode characters including emoji and CJK.

Privacy

All conversion happens in your browser. No text or hex data is sent to any server.

Related Tools

More Encoding & Crypto Tools