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
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!:
- H has the code 72. 72 = 4 × 16 + 8, so it is 48.
- i has the code 105. 105 = 6 × 16 + 9, so it is 69.
- ! has the code 33. 33 = 2 × 16 + 1, so it is 21.
- 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.
Hex values of common characters
| Character | Hex | Decimal | Character | Hex | Decimal |
|---|---|---|---|---|---|
| space | 20 | 32 | 0 | 30 | 48 |
! | 21 | 33 | 9 | 39 | 57 |
A | 41 | 65 | a | 61 | 97 |
B | 42 | 66 | b | 62 | 98 |
C | 43 | 67 | c | 63 | 99 |
M | 4d | 77 | m | 6d | 109 |
Z | 5a | 90 | z | 7a | 122 |
@ | 40 | 64 | ~ | 7e | 126 |
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?
Why does one character sometimes give several hex values?
c3 a9 and 😀 is f0 9f 98 80.What formats does Hex to text accept?
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?
Is hex a kind of encryption?
Sources
- RFC 3629: UTF-8, a transformation format of ISO 10646
- RFC 4648: The Base16, Base32, and Base64 Data Encodings, section 8 — Base16, the formal name for hex encoding