Text to Hex Converter
Type or paste text to see the hexadecimal value of every byte, or paste hex to turn it back into text. Choose the encoding, because the bytes of the same text differ between UTF-8, UTF-16 and Latin-1, and choose how the hex is written: with spaces, commas or lines, with a 0x, \x or % prefix, in upper or lower case. Everything runs in your browser.
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21
Related Tools
[4 suggestions]Text to Binary Translator
Convert text to binary, hex, decimal, or octal and decode it back, using UTF-8 bytes.
Developer & WebNumber Base Converter
Convert whole numbers between binary, octal, decimal, hex and any base from 2 to 36, with two's complement.
Developer & WebBase64 Encoder / Decoder
Easily encode plain text to Base64 format or decode Base64 back to readable text.
Developer & WebURL Encoder / Decoder
Encode URI components or decode percent-encoded URLs safely and reliably.
Developer & WebAbout the Text to Hex Converter
The text to hex converter first turns your text into bytes with the encoding you choose, then writes each byte as two hexadecimal digits. In UTF-8, plain English letters are one byte each, so Hello is 48 65 6C 6C 6F, an accented letter such as e with an acute accent is two bytes, C3 A9, the euro sign is three, E2 82 AC, and an emoji is four, such as F0 9F 98 80. UTF-16 uses two bytes for most characters and four for emoji, and the byte order matters: the letter A is 41 00 in little endian and 00 41 in big endian. Latin-1 uses one byte for the first 256 characters and refuses anything else, such as the euro sign, instead of replacing it with a question mark. Going back, the tool reads hex written as 48 65, 4865, 0x48,0x65, \x48\x65 or %48%65, and each byte must have exactly two digits, so a stray digit is reported with its position. Bytes that are not valid in the chosen encoding, such as an overlong UTF-8 sequence, a surrogate or a sequence cut short, are reported with the number of the first bad byte instead of being turned into a replacement character. Text with half of an emoji, a lone surrogate, cannot be encoded and is also reported. The conversions were compared with the codecs of Python on 20,000 random texts and 30,000 byte sequences, valid and damaged, and match, including the position of the first invalid UTF-8 byte. Everything runs in your browser and nothing is uploaded.
How do I convert text to hex?▾
Turn the text into bytes with an encoding such as UTF-8, then write each byte as two hexadecimal digits. The text Hi is the bytes 72 and 105, which are 48 and 69 in hex. The tool does this for any text.
Why does one character give several hex bytes?▾
Because UTF-8 uses between one and four bytes for a character. Plain English letters are one byte. Accented letters take two, most other scripts and the euro sign take three, and emoji take four.
What is the difference between UTF-8 and UTF-16 in hex?▾
UTF-8 writes ASCII characters as one byte, while UTF-16 uses two bytes for most characters and the order of the two bytes depends on little or big endian. The letter A is 41 in UTF-8, 41 00 in UTF-16 little endian and 00 41 in UTF-16 big endian.
Can I paste hex with 0x or \x in front of each byte?▾
Yes. The tool reads 0x48, \x48 and %48, as well as bytes separated by spaces, commas, colons or hyphens, or no separator at all. Each byte must have two digits.
Is my text uploaded?▾
No. The conversion runs in your browser, and what you type or paste is not sent anywhere or stored.