Text to Hex Converter

Turn any string into the hexadecimal values of its UTF-8 bytes, formatted the way your code or protocol expects.

Loading tool…

About the Text to Hex

Each character is first encoded as UTF-8 and every byte is written as two hex digits. ASCII characters take one byte (A → 41), while other characters take two to four: é → c3 a9, ✓ → e2 9c 93, and an emoji such as 🚀 → f0 9f 9a 80. The status line shows the byte count, which is often larger than the character count.

Choose the format for your destination: space-separated for reading, no separator for compact strings or database literals (X'48656C6C6F' in SQL), colons for MAC-style dumps, 0x prefixes and commas for C or JavaScript arrays (0x48,0x69), and \x for escape sequences in C, Python or shell printf strings.

Seeing the bytes is the fastest way to debug mojibake: if é shows up as c3 83 c2 a9, the text was UTF-8 encoded twice. The conversion runs locally in your browser.

How to use it

  1. Type or paste your text.
  2. Pick a separator and optional 0x or \x prefix.
  3. Toggle upper case if needed.
  4. Copy the hex output.

Frequently asked questions

Why do some characters produce more than one hex byte?
UTF-8 uses 1 byte for ASCII and 2–4 bytes for other characters. The tool shows the real bytes that would be stored or sent.
How do I make a C byte array from a string?
Choose the 0x prefix and the comma separator, then wrap the output in braces: { 0x48,0x69 }.
Is this the same as the character's Unicode code point?
Only for ASCII. For é the code point is U+00E9 but the UTF-8 bytes are C3 A9. Use the Unicode escape tool for code points.

Related tools