Skip to content
tools.best

Browse all tools

Text to Hex Converter

Type text to see the hexadecimal value of each of its bytes, or switch direction and paste hex to read it as text.

Runs in your browser. Your text is not sent to a server. Sources: RFC 3629 Updated

Direction
3 characters
8 characters

3 bytes

How text becomes hexadecimal

character → UTF-8 bytes → two hex digits per byte

Hexadecimal is base 16: the digits 0 to 9 and then a to f for the values 10 to 15. Two hex digits cover 0 to 255, exactly one byte, which is why hex is the usual way to write bytes. The first digit counts sixteens and the second counts ones: 48 is 4 × 16 + 8 = 72.

The same bytes appear in other notations on this site: text to binary writes each one as eight bits, and the URL encoder puts a % in front of each hex pair. Hex color codes use the same base-16 digits, which the hex to RGB converter turns into numbers from 0 to 255.

How to convert text to hex: a worked example

The text Hi!:

  1. H has the code 72. 72 = 4 × 16 + 8, so it is 48.
  2. i has the code 105. 105 = 6 × 16 + 9, so it is 69.
  3. ! has the code 33. 33 = 2 × 16 + 1, so it is 21.
  4. Result: 48 69 21. With the 0x prefix: 0x48 0x69 0x21. Without spaces, in uppercase: 486921.

Outside basic Latin, one character is several bytes: é is c3 a9 and € is e2 82 ac.

UTF-8 bytes of three characters in hex: H is 48 (1 byte), é is c3 a9 (2 bytes) and € is e2 82 ac (3 bytes), so "Hé€" is 3 characters and 6 bytes.
Basic Latin letters are one byte each; accented letters and symbols take two or three.

Hex values of common characters

CharacterHexDecimalCharacterHexDecimal
space203203048
!213393957
A4165a6197
B4266b6298
C4367c6399
M4d77m6d109
Z5a90z7a122
@4064~7e126

Capital letters run from 41 (A) to 5a (Z) and small letters from 61 (a) to 7a (z): a small letter is always its capital plus 20 in hex. Digits run from 30 (0) to 39 (9). The complete table is on the ASCII to text page.

Text to Hex Converter: FAQ

How do I convert text to hex?
Each character is stored as one or more bytes, and each byte is written as two hexadecimal digits. The letter H is byte 72 in decimal, which is 48 in hex. Type your text in the left pane and read the bytes on the right.
Why does one character sometimes give several hex values?
The tool shows UTF-8 bytes. Basic Latin letters, digits and punctuation take one byte each. Accented letters take two, most other scripts three, and emoji four. é is c3 a9 and 😀 is f0 9f 98 80.
What formats does Hex to text accept?
Bytes with or without spaces, in upper or lower case, with or without a 0x or \x prefix, and separated by commas, colons or dashes. 48 69, 4869, 0x48,0x69 and 48:69 all read as Hi.
Why does it say the bytes are not valid UTF-8?
Not every sequence of bytes is text. If the hex you pasted is part of a file, a hash or a key, or text in another encoding such as Latin-1, it cannot be shown as UTF-8 text. A hash like an MD5 sum is a number, not encoded text.
Is hex a kind of encryption?
No. Hex is only another way of writing the same bytes, and anyone can convert it back. Do not use it to hide passwords or private data.

Sources