Text to hex converter — and hex back to text, in six formats

Type text to see its UTF-8 bytes in hexadecimal, in the format your code or tool expects, or switch to Hex → text to turn hex bytes back into readable text.

Live demo · real result from this tool
Direction

Result

48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21

Processed on your device — nothing is uploaded.

How to use the text to hex converter

  1. Choose Text → hex or Hex → text.
  2. Type or paste into Your text.
  3. For text to hex, pick a Format: 48 65 6c, 48656c, 48:65:6c, 0x48 0x65, \x48\x65 or %48%65 (URL). Tick Uppercase for A–F instead of a–f.
  4. Copy the Result.

What it does and when to use it

Hexadecimal is the usual way to show raw bytes, because each byte is always exactly two digits from 00 to ff. This tool turns text into those bytes and back. Developers use it to:

  • Write a string as a byte array or escape sequence for C, Python, JavaScript or shell scripts.
  • Check what a value really contains when an invisible character or the wrong encoding causes a bug.
  • Compare bytes with a protocol trace, a database dump or a debugger.
  • Decode hex found in logs, URLs or config files back to text.

For a full byte view with offsets and a character column, use the hex dump viewer. If your hex came from a Base64 value, the Base64 to hex converter goes straight between the two. To look up one character’s code point and bytes, use the Unicode character lookup.

How it works

Text → hex: the text is encoded as UTF-8, and each byte is written as two hex digits. Then the format is applied:

Format “Hi” becomes
48 65 6c 48 69
48656c 4869
48:65:6c 48:69
0x48 0x65 0x48 0x69
\x48\x65 \x48\x69
%48%65 (URL) %48%69

Hex → text: 0x, \x and % prefixes and separators are removed, the digits are checked, and each pair becomes a byte. The bytes must be valid UTF-8, otherwise you get an error rather than garbled text. This is the Base16 idea from RFC 4648, applied to UTF-8 text. It runs in your browser.

Worked examples

Hello              →  48 65 6c 6c 6f
€   (\x escape)    →  \xe2\x82\xac
café (%XX URL)     →  %63%61%66%C3%A9
0x48 0x69          →  Hi                (Hex → text)
48 6               →  Hex needs two digits per byte; the input has an odd number of digits.

The euro sign is three bytes in UTF-8, so it needs three escapes. In the URL format, the é in café becomes %C3%A9, which is exactly what a browser sends for it.

Limits and tips

  • Hex doubles the size of the data: every byte becomes two characters, plus any separators.
  • The decoder needs UTF-8. Hex of Latin-1 or UTF-16 text will be rejected; the hex dump viewer can still show those bytes.
  • An odd number of digits usually means one digit was lost when copying. Check the start and end of your hex.

Frequently asked questions

Why does one character give more than two hex digits?
Because the tool shows UTF-8 bytes, and many characters need more than one byte. Plain English letters take 1 byte (2 hex digits), é takes 2, € takes 3 and most emoji take 4. So "café" is 5 bytes, 63 61 66 c3 a9.
Which hex formats can I paste to decode?
Any of the six the tool writes: spaced pairs, one long run, colons, 0x prefixes, \x escapes and %XX. Commas, semicolons and dashes are accepted as separators too, and upper and lower case both work.
Why do I get "These bytes are not valid UTF-8 text"?
The hex is fine, but the bytes do not form UTF-8 text. That happens with binary data such as hashes and keys, or with text saved in another encoding such as Latin-1. To inspect such bytes, use a hex dump instead.
Is hex a form of encryption?
No. Hex is just another way to write numbers. Every byte is shown openly and anyone can convert it back. It doubles the size and hides nothing.
Should I use upper or lower case?
Both mean the same. Lower case is common for hashes and byte dumps, upper case for colour codes and some protocols. The %XX URL format is always upper case here, as RFC 3986 recommends.

Sources

  1. RFC 4648: The Base16, Base32, and Base64 Data Encodings (section 8, Base16) — IETF / RFC Editor, accessed 2026-10-08

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close