Hex Encode

Convert text or data to hexadecimal representation — each character as its UTF-8 byte hex values.

About Hex Encoding

Hexadecimal (hex) encoding represents binary data as a string of hexadecimal digits (0–9, A–F), where each pair of hex digits represents one byte of data. For example, the letter 'A' is ASCII 65 decimal, which is 0x41 in hex. The word "Hello" encodes to "48 65 6C 6C 6F" in hex.

Hex encoding is ubiquitous in programming and computer science: cryptographic hash outputs (MD5, SHA, etc.) are displayed in hex, MAC addresses use hex notation (AA:BB:CC:DD:EE:FF), color values in CSS are hex (#FF5733), memory addresses in debuggers are hex, and network packet dumps (Wireshark, tcpdump) show data in hex.

This encoder converts each character to its UTF-8 byte representation in hexadecimal. For ASCII characters (0–127), this is simply the ASCII code in hex. For multi-byte UTF-8 characters (like emojis and non-Latin scripts), each byte is encoded separately, producing 2–4 hex pairs per character.

Frequently Asked Questions

Why do some characters produce more than 2 hex digits?
Non-ASCII characters are encoded in UTF-8 using multiple bytes. For example, the euro sign € (U+20AC) encodes to 3 bytes in UTF-8: E2 82 AC. An emoji like 😀 (U+1F600) uses 4 bytes: F0 9F 98 80. Each byte becomes a 2-digit hex pair.
What's the difference between hex encoding and Base64?
Both represent binary data as text. Hex uses 2 characters per byte (overhead: 100%), while Base64 uses ~1.33 characters per byte (overhead: 33%). Hex is more human-readable and easier to inspect byte-by-byte, while Base64 is more compact and used for data transmission.
What format are cryptographic hashes in?
MD5, SHA-1, SHA-256, and other hashes are raw binary outputs, but they're almost always displayed in lowercase hex without separators. For example, an MD5 hash is 32 hex characters representing 16 bytes (128 bits).