Hex Translator

Type text and see it as hexadecimal: each character becomes its UTF-8 bytes, each byte written as two hex digits from 00 to ff, with a space between bytes. Paste hex and the tool reads it back to text, whether the pairs are spaced, run together or prefixed with 0x. The round trip is exact for any text, including accented letters, other scripts and emoji, and capitals stay capitals.

hexadecimal
 

How to use the hex translator

  1. Type or paste text. The hex appears as you type, two digits per byte with a space between bytes.
  2. To decode, switch to hex to text and paste the digits. Spaces and 0x prefixes are optional, and upper or lowercase digits both work.
  3. Accented letters, other scripts and emoji take two to four bytes each; the decoder reads them back correctly.
  4. Copy the result with the copy button.

Examples

Hi48 69
Hello, World!48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21
café63 61 66 c3 a9

About hexadecimal

Hexadecimal is base 16. Where decimal counts with ten digits and rolls over at 10, hex has sixteen, 0 to 9 and then a to f for the values ten to fifteen, and rolls over at sixteen. So 0a is ten, 10 is sixteen, ff is 255. The reason programmers use it rather than decimal is that sixteen is a power of two: one hex digit is exactly four bits, a group sometimes called a nibble, and two hex digits are exactly one byte, the eight-bit unit that computers store and move. A byte written in decimal takes one, two or three digits and lines up with nothing; written in hex it is always two digits, and a long run of bytes reads as a neat row of pairs. Binary is more honest about the bits but eight times longer than the byte count, and the eye loses its place in a wall of 0s and 1s. Hex is the compromise that most of computing settled on.

You meet hex more often than the name suggests. A CSS color such as #ff0000 is three bytes, red, green and blue, each from 00 to ff, and #ff0000 is full red with no green or blue. A MAC address like 00:1a:2b:3c:4d:5e is six bytes. A memory dump, a file viewed in a hex editor, a git commit id, an MD5 or SHA-256 hash, and the %20 that stands for a space in a web address are all bytes written as hex pairs. Under all of them is the same idea: a value from 0 to 255, shown as two digits. Text joins in through character encoding. ASCII, from 1963, assigns the numbers 0 to 127 to English letters, digits and punctuation: capital A is 65, which is 41 in hex, and lowercase a is 97, hex 61. Unicode extends the table to every script, and UTF-8, from 1992, writes each code point as one to four bytes.

This translator uses UTF-8. It takes each character you type, writes its UTF-8 bytes and prints each byte as two lowercase hex digits, with one space between bytes. "Hi" becomes 48 69. A space between words is a character, byte 20, so it appears in the output, and so do commas, exclamation marks and line breaks: "Hello, World!" is 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21. Case is preserved, because H and h have different codes. Characters outside ASCII take more than one byte: é is c3 a9, a Chinese character is three pairs and an emoji is four. The first byte of such a sequence always falls between c2 and f4, which is how a decoder knows a multi-byte character has begun. The binary translator on this site writes the same bytes eight digits at a time; this page writes them two digits at a time, and the two outputs describe the identical sequence of bytes.

Decoding reads the digits back. The tool ignores spaces, line breaks and any 0x prefixes, takes the remaining hex digits two at a time and passes the bytes through a UTF-8 decoder, so 4869, 48 69 and 0x48 0x69 all decode to Hi. Upper and lowercase hex digits are read alike, so 4A and 4a are the same byte. Because the encoder and decoder follow the same rules, the round trip is exact: anything you encode here decodes to the same text, accents, emoji and all. Two things can go wrong with hex from elsewhere. An odd number of digits means a byte is missing half of itself, and the last character will be wrong. And bytes that are not valid UTF-8, for instance text saved in Windows-1252, where é is the single byte e9 rather than c3 a9, decode to a replacement character rather than the intended letter.

People use hex text for the same reasons they use binary: puzzles and escape rooms, geocaching clues, capture-the-flag challenges, checking what a file or a network packet really contains, and reading a string a program printed as bytes. Some things this page does not do. It does not convert numbers: typing 255 gives 32 35 35, the codes for the three characters 2, 5 and 5, not ff. It does not make color codes; #ff0000 is a color only because a stylesheet reads it as three RGB bytes, and the hex for the word red is 72 65 64. It does not encrypt anything. Hex is an encoding that anyone can reverse with this page or any other, so it hides text from a glance and from nothing else, and it is not a translation: the words stay in whatever language you typed them. The conversion runs in your browser and no text is sent to a server.

Frequently asked questions

Why is every character two digits long?

Because a byte is eight bits and one hex digit holds four, so two digits cover exactly one byte, from 00 to ff. The tool always writes both digits, padding with a leading zero where the value is small, so that a line feed is 0a rather than a. That fixed width is what lets the decoder work without spaces: it takes the digits two at a time. Characters outside ASCII take two, three or four bytes, so they appear as two to four pairs.

What is the difference between hex and binary?

None in the bytes, only in how they are written. Binary shows each byte as eight 0s and 1s; hex groups those bits four at a time and gives each group one digit, so 01001000 and 48 are the same byte, the capital H. Hex is a quarter of the length and easier to read, which is why hex editors, hashes and memory dumps use it. The binary translator on this site produces the eight-digit form of exactly the same bytes this page produces.

Why does é come out as two bytes?

é is Unicode code point 233, above the 127 that fit in one byte under UTF-8, so it is written as the two-byte sequence c3 a9. The first byte, c3, tells a decoder that one more byte follows; the second, a9, is a continuation byte. Older single-byte encodings such as Latin-1 and Windows-1252 wrote é as the single byte e9, and hex produced that way decodes to a replacement character here rather than the letter.

Is 0x48 the same as 48?

Yes. The 0x prefix is a convention from the C programming language for marking a number as hexadecimal, so that 0x10 is sixteen rather than ten, and many languages, debuggers and documents copy it. The digits after it are the byte. The decoder strips every 0x it finds, along with spaces and line breaks, and reads the pairs that remain, so 0x48 0x69, 48 69 and 4869 all give Hi. The encoder writes bare pairs without the prefix.

Can I use this to convert a number to hex, or to make a color code?

No. This page encodes characters, not values. Typing 255 gives 32 35 35, the ASCII codes of the digits 2, 5 and 5, and typing red gives 72 65 64, not a color. A CSS color such as #ff0000 is three byte values chosen for red, green and blue, and converting a number like 255 to ff is arithmetic rather than encoding. What this page does is show the bytes that any text is stored as, and read such bytes back to text.