Hex Encoder / Decoder

Convert text to hexadecimal bytes and decode hex back to text

What is it and how does it work?

Hexadecimal encoding converts text or binary data to its hexadecimal (base-16) representation, where each byte is expressed as two hex digits (00–FF). Because hex is a compact, human-readable way to display binary data without ambiguity or whitespace confusion, it's the standard for representing raw bytes in debugging, cryptography, binary file inspection, and low-level programming. The string "Hi" in ASCII becomes 48 69 in hex.

This tool converts between text and hex in both directions. It handles standard UTF-8 text encoding (where non-ASCII characters become multi-byte sequences) and shows the hex values with optional spacing, uppercase/lowercase, and a 0x prefix. It's useful for inspecting what bytes a particular string produces, verifying encoding in protocols, or preparing data for systems that require hex-formatted input.

Common use cases

Frequently asked questions

Why do non-ASCII characters produce more than two hex digits?

Each hex byte pair represents 8 bits. ASCII characters (English letters, digits, punctuation) fit in one byte (00–7F). Non-ASCII characters (accents, CJK, emoji) use 2–4 bytes in UTF-8. The accented "é" is C3 A9 in hex (two bytes); emoji like 🎉 are F0 9F 8E 89 (four bytes).

What is the difference between hex encoding and Base64?

Both encode binary data as printable text. Hex is 2 characters per byte (100% overhead); Base64 is ~1.33 characters per byte (33% overhead). Hex is more human-readable for byte inspection; Base64 is more efficient for data transfer. Use hex for debugging; use Base64 for embedding binary data in JSON, HTML, or HTTP.

What does the 0x prefix mean?

0x is a convention in C and most programming languages to indicate a hexadecimal literal. 0xFF means 255 in decimal. The prefix has no meaning in the encoding itself — it's just a visual indicator to distinguish hex from decimal.

How do I convert a hex colour code to a number?

CSS colour codes like #FF5733 are three hex byte pairs: FF=red (255), 57=green (87), 33=blue (51). Parse each pair as base-16 to get the RGB value: parseInt("FF", 16) = 255 in JavaScript.

Security

Password Strength Checker · ROT13 Cipher · Base32 Encoder / Decoder · Caesar Cipher · Vigenère Cipher · Atbash Cipher