Skip to content
AZ Tools

Text to Hex Converter (and back)

Convert text to hexadecimal bytes and decode hex back to text, with UTF-8 support, in your browser.

Output

How to use

  1. Choose the direction: text to hex, or hex to text.
  2. For text to hex, pick the byte separator and letter case.
  3. Paste your input and copy the converted result.

About this tool

Show

Paste text to get its UTF-8 bytes as hexadecimal, or paste hex to decode it back to text. Choose the separator — space, none, colon or \x — and upper or lower case, so the output drops straight into a C array, a Wireshark filter or a shell command. Because the encoding is UTF-8 and not one byte per character, an accented letter takes two bytes and most emoji take four; the byte count is the real answer to how long a string is on the wire. Decoding is deliberately forgiving: 0x and \x prefixes and every non-hex character are stripped before parsing, so hex copied from a hex editor, a log line or a packet dump all work. An odd number of digits is reported as an error rather than guessed at.

Frequently asked questions

How are non-ASCII characters handled?

Text is encoded as UTF-8 first, so accented letters, emoji and CJK characters become their multi-byte hex sequences and decode back exactly.

What hex formats can I decode?

Any. Spaces, colons, newlines and 0x or \x prefixes are stripped, then the remaining hex digits are read two at a time. An odd number of digits is reported as an error.

What does the separator option do?

It sets how bytes are joined when encoding: a space (48 65), nothing (4865), a colon (48:65) or a \x prefix (\x48\x65). Decoding accepts all of these.

Is my text sent anywhere?

No. The conversion happens entirely in your browser; nothing is uploaded.

Why is my emoji four bytes and my accented letter two?

Because UTF-8 is variable-width. ASCII characters take one byte, most accented and Greek or Cyrillic letters take two, most CJK characters three, and emoji and rarer symbols four. That is why a byte count and a character count disagree, and why a database column sized in bytes runs out sooner than expected.

Why does an odd number of hex digits fail?

Because a byte is two hex digits, so an odd count means one digit is missing and there is no safe way to guess which end. Rather than pad a nibble and hand back plausible-looking wrong bytes, it reports the error — usually a sign that a copied dump was truncated.

Guides on this topic

Related tools