Text to Hex Converter
NewConvert text into hexadecimal byte values. Enter text, choose UTF-8, UTF-16 or Latin-1, and select a hex format. The result updates as you type, locally in your browser. Select Try an example to see how it works.
How to convert text to hex
- Type or paste your text into Input text.
- Choose the character encoding. UTF-8 is recommended for most uses.
- Select an output format, such as plain hex, spaced bytes or
0xprefixes. - Copy the hexadecimal output, or select Convert back to text to decode that output on the reverse page.
For example, Hello encoded as UTF-8 becomes 48 65 6c 6c 6f (or 48656c6c6f without spaces). Unlike ASCII letters, some characters require multiple UTF-8 bytes: é becomes c3 a9 and 😀 becomes f0 9f 98 80.
Text to hex examples
| Input text | UTF-8 hexadecimal bytes |
|---|---|
Hello | 48 65 6c 6c 6f |
Hi! | 48 69 21 |
é | c3 a9 |
€ | e2 82 ac |
😀 | f0 9f 98 80 |
The hexadecimal values represent the encoded bytes, not necessarily one value per character. Spaces shown between bytes are optional.
Hexadecimal output formats
| Format | Example for Hello |
|---|---|
| Plain | 48656c6c6f |
| Spaced bytes | 48 65 6c 6c 6f |
| Colon-separated | 48:65:6c:6c:6f |
0x prefixes | 0x48 0x65 0x6c 0x6c 0x6f |
| Escaped bytes | \x48\x65\x6c\x6c\x6f |
| C-style byte list | 0x48, 0x65, 0x6c, 0x6c, 0x6f |
Use Uppercase hex to display letters A–F in uppercase. That changes only the notation, not the underlying bytes.
UTF-8, UTF-16 and Latin-1 differences
Text must be encoded into bytes before it can be expressed in hexadecimal.
| Encoding | Bytes for Hé | Notes |
|---|---|---|
| UTF-8 | 48 c3 a9 | Variable-length Unicode encoding; recommended default |
| UTF-16 LE | 48 00 e9 00 | Little-endian 16-bit code units |
| UTF-16 BE | 00 48 00 e9 | Big-endian 16-bit code units |
| Latin-1 | 48 e9 | One byte per supported character; cannot encode emoji |
UTF-8 encodes ASCII characters using a single byte. Unicode characters outside ASCII may require two, three or four bytes. Latin-1 supports only characters within U+0000–U+00FF; an unsupported character produces an error rather than an incorrect substitute.
When is text to hex useful?
Hexadecimal byte strings are commonly used when inspecting data in debugging tools, reading protocol examples, comparing encodings or including byte constants in source code. Hex encoding is not encryption or hashing: it only changes how encoded bytes are written.
Convert text to hex in code
In JavaScript:
Array.from(new TextEncoder().encode('Hello'), byte =>
byte.toString(16).padStart(2, '0')
).join(''); // '48656c6c6f'
In Python:
'Hello'.encode('utf-8').hex()
# '48656c6c6f'
On the command line:
printf 'Hello' | xxd -p
# 48656c6c6f
Frequently asked questions
What is text to hex conversion?
Text is first encoded into bytes using a character encoding such as UTF-8. Each byte is then displayed as two hexadecimal digits. The conversion is reversible when the original bytes and encoding are known.
Does hexadecimal encoding encrypt my text?
No. Hex is a readable representation of bytes, not encryption. Anyone can decode it back to the original text.
Why does one character produce more than two hex digits?
Some Unicode characters need multiple bytes. For example, UTF-8 represents é with two bytes (c3 a9) and 😀 with four bytes (f0 9f 98 80).
Is my text sent to a server?
No. Conversion happens in your browser. Do not place sensitive text in shareable prefilled URLs, since URLs can appear in browser history and logs.
Related tools
- Hex to Text Converter — Decode hexadecimal bytes into readable text.
- Base64 Encoder and Decoder — Encode text with Base64 instead of hex.
- URL Encoder and Decoder — Percent-encode text for URLs.
- SHA-256 Hash Calculator — Calculate a cryptographic digest, which is not reversible.
Further reading
Last updated: