Hex Encoder

Convert text to hexadecimal — useful for debugging and binary inspection

Free Client-Side No Login No Storage
Loading tool...

How to Use the Hex Encoder

  1. Enter text to convert to hexadecimal.
  2. Choose a separator (none, space, colon, or dash) and case.
  3. Click Encode to get the hex representation.

Each character is converted to its UTF-8 byte value in hexadecimal. Useful for debugging, network packet analysis, and binary data inspection.

What is Hexadecimal Encoding?

Hexadecimal encoding (base-16) translates binary byte streams or text characters into two-digit hexadecimal values ranging from 00 to FF. Because each byte is mapped to exactly two printable ASCII characters (0-9 and a-f), hex encoding provides an unambiguous, human-readable representation of arbitrary binary data.

Common Uses

  • Representing raw cryptographic keys, initialization vectors, and hash digests
  • Inspecting binary file magic headers (such as `89 50 4E 47` for PNG files)
  • Debugging serial communications, firmware protocols, and embedded memory dumps
  • Safely transmitting binary data across legacy systems that require 7-bit ASCII

Frequently Asked Questions

How does Hex encoding compare to Base64 encoding?

Hex encoding converts each byte into 2 ASCII characters, causing a 100% size expansion. Base64 encodes 3 bytes into 4 characters (approx. 33% expansion). Base64 is more compact for storage, while Hex is much easier for humans to read and parse byte-by-byte.

What character encoding does this tool use before converting to hex?

The encoder converts text strings to UTF-8 byte arrays before translating each byte to its corresponding hexadecimal pair, ensuring full international character support.

Can hex encoding represent non-printable control characters?

Yes. Every single byte value from 0 to 255 (including null bytes, line feeds, and bell characters) maps to a distinct two-digit hex code, making it ideal for inspecting raw binary payloads.

Notes from this implementation

Two hex digits per byte

Each byte becomes two characters from 0-9a-f. The string hello is 68656c6c6f. A space between bytes is a display choice; the digits are the data. Upper or lower case is the same value.

People paste a hash here hoping to “encode” it again. The hash is already hex. Encoding it a second time hashes nothing; it encodes the ASCII characters of the hex text, which doubles the length and confuses the next comparison. Encode raw text or raw bytes. Leave digests alone.

Odd length

Hex has to come in pairs. A 3-digit string is not a shorthand for a byte. The encoder will not invent a leading zero on decode; the decoder page should reject an odd number of digits.