How hex encoding works
Hexadecimal is base 16. It counts with sixteen digits, 0 to 9 and then A to F. One hex digit holds exactly 4 bits, so two digits hold one byte. That is why hex is the usual way to show raw bytes: it is short, and every byte always takes two characters.
To turn text into hex, the encoder converts the text to UTF-8 bytes and writes each byte as two hex digits. Decoding reverses this.
Hex digits
| Hex | Decimal | Binary | Hex | Decimal | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | A | 10 | 1010 |
| 3 | 3 | 0011 | B | 11 | 1011 |
| 4 | 4 | 0100 | C | 12 | 1100 |
| 5 | 5 | 0101 | D | 13 | 1101 |
| 6 | 6 | 0110 | E | 14 | 1110 |
| 7 | 7 | 0111 | F | 15 | 1111 |
Hex to text table
| Character | Hex | Decimal |
|---|---|---|
| A | 41 | 65 |
| Z | 5A | 90 |
| a | 61 | 97 |
| z | 7A | 122 |
| 0 | 30 | 48 |
| Space | 20 | 32 |
| ! | 21 | 33 |
| Line break | 0A | 10 |
Letters and digits run in order, so 42 is B, 43 is C, and 31 to 39 are the digits 1 to 9.
Accented letters and emoji
Characters outside plain English take more than one byte in UTF-8, so they also take more than one hex pair:
If you decode hex and see odd symbols where accented letters should be, the hex was probably made with an older encoding such as Latin-1 or Windows-1252 rather than UTF-8.
Hex formats you will see
Hex shows up written in several ways. The decoder accepts all of these and ignores the extra characters:
Upper and lower case mean the same thing, so 6C and 6c are both 108. When encoding, the Gap and Case options above choose how the output looks.
Hex, binary and Base64
All three write the same bytes. Binary uses 8 digits per byte and is easy to read bit by bit. Hex uses 2 per byte and is the usual choice for debugging, colour codes and hashes. Base64 is the shortest, about 1.33 characters per byte, and is used to put binary data inside text such as emails and JSON.
Questions about hex
How do I convert hex to text?
Paste the hex into the decoder above. By hand, split it into pairs of digits, turn each pair into a number (first digit times 16 plus the second digit, with A to F meaning 10 to 15) and look the number up in a character table. 48 is 72, which is H.
What does 48 65 6C 6C 6F mean?
It is the word Hello. 48 is H, 65 is e, 6C is l and 6F is o.
Why does my hex decode to strange characters?
The bytes are probably not text. Hashes, encrypted data, images and compressed files are all often shown as hex, and none of them turn into readable words. If the hex has 32, 40 or 64 digits and no spaces, it is likely an MD5, SHA-1 or SHA-256 hash.
Does the decoder accept 0x and other prefixes?
Yes. It ignores 0x and \x prefixes and any spaces, colons, commas or dashes between bytes, so 0x48 0x69, 48:69 and 4869 all decode to Hi.
Is hex a kind of encryption?
No. Hex is just another way to write bytes, and anyone can read it back. Some puzzles call it a hexadecimal cipher, but there is no key involved.
Is my text sent to a server?
No. The conversion runs in your browser with JavaScript, and nothing you type or paste leaves your device.