Text to Hex Converter
Convert text into hexadecimal bytes using UTF-8 encoding instantly. Choose uppercase, separators, or a 0x prefix per byte.
How to Convert Text to Hex
Converting text to hexadecimal encodes the underlying bytes of each character:
- Encode the text as UTF-8 bytes
- Take each byte value, which ranges from 0 to 255
- Write each byte as two hexadecimal digits (00 to FF)
- Join the byte pairs with your chosen separator
Example: Convert Hi to hex:
- H = 72 = 0x48
- i = 105 = 0x69
- Result: 48 69
Code Examples
const text = "Hi";
[...new TextEncoder().encode(text)]
.map((b) => b.toString(16).padStart(2, "0"))
.join(" "); // "48 69"Frequently Asked Questions
How do I convert text to hex?
Each character is encoded to one or more UTF-8 bytes, and each byte is written as two hex digits. For example, Hi becomes 48 69.
What separator options are available?
You can output bytes separated by spaces, commas, a 0x prefix on each byte, or with no separator as one continuous hex string. Uppercase output is also optional.
Is text to hex the same as ASCII to hex?
For basic English letters, digits, and punctuation, UTF-8 matches ASCII, so the hex values are identical. Characters outside ASCII use two to four UTF-8 bytes.
How many hex characters does each letter use?
Each byte is exactly two hex digits. Standard ASCII characters are one byte (two hex digits), while emoji and many accented characters take two to four bytes.
Related Tools
Hex to Text Converter
Convert hexadecimal bytes into readable ASCII or UTF-8 text instantly.
Text to Binary Converter
Convert plain text into 8-bit binary bytes instantly.
ASCII Converter
Convert text to ASCII codes and ASCII codes to text.
Unicode Converter
Convert text to Unicode code points and vice versa.