Menu

Text to Hex Converter

Type text to see each UTF-8 byte as two hex digits ("Hi" is 48 69), or switch to Hex → text to decode hex with or without spaces, 0x or \x prefixes.

0 words 0 characters 0 lines

Direction

Continue with this text: Text to binaryBase64URL encoder

Your text stays in your browser: nothing is uploaded or stored on a server.

How to use the text to hex converter

  1. Paste or type your text in the input box, or click Example to load Café ☕.
  2. Pick a direction. Text → hex (the default) encodes; Hex → text decodes.
  3. Format the hex with Between bytes, Prefix and Uppercase (A–F). These only change the encoded output; the decoder reads all of the formats.
  4. Copy the result, click Download .txt, or click Use as input to send it back to the input box, for example to decode it again and check the round trip.

The example shows the main idea in one line: Café ☕ becomes 43 61 66 c3 a9 20 e2 98 95. The three plain letters take one byte each, é takes two, the space is 20 and the coffee cup emoji takes three.

The formatting options

Every option changes only how the bytes are written, never which bytes they are. Here is the word Hello with each setting:

Option Setting Output
Between bytes Space (default) 48 65 6c 6c 6f
Between bytes Nothing 48656c6c6f
Between bytes Colon, with Uppercase 48:65:6C:6C:6F
Between bytes Comma, with prefix 0x 0x48, 0x65, 0x6c, 0x6c, 0x6f
Prefix \x, with Nothing between \x48\x65\x6c\x6c\x6f
  • Space is the usual way to show bytes to people and the easiest to read back.
  • Nothing gives one continuous string, the form used in hashes, color-style codes and many APIs.
  • Colon matches the style of MAC addresses and certificate fingerprints.
  • Comma with the 0x prefix gives a list you can paste into a C, Java, JavaScript or Python array of byte values.
  • \x before every byte is the escape used inside string literals in Python, C and many shells, so \x48\x69 is “Hi”.
  • Uppercase (A–F) changes only the digits a to f. The prefix stays lowercase (0x6C, not 0X6C).

How text becomes hex

Hexadecimal is base 16: the digits 0–9 and then a–f for the values 10 to 15. Two hex digits cover exactly one byte (00 to ff, or 0 to 255), which is why hex is the common way to show raw bytes.

The tool first turns your text into bytes with UTF-8, the encoding used by almost every web page, and then writes each byte as two digits. Under RFC 3629, UTF-8 uses one to four bytes per character, and the 128 ASCII characters keep their ASCII values in a single byte:

Characters Bytes Example Hex
ASCII letters, digits, punctuation, space 1 A 41
Accented Latin, Greek, Cyrillic, Hebrew, Arabic 2 ñ c3 b1
Most other scripts, €, symbols 3 中 e4 b8 ad
Emoji and rarer characters 4 😀 f0 9f 98 80

A few details follow from that:

  • Spaces and line breaks are bytes too. A space is 20, a tab 09 and a line break 0a. Text copied from Windows can carry 0d 0a (carriage return + line feed) at the end of each line.
  • What looks like one character can be several. The emoji 👍🏽 is a thumbs up plus a skin-tone modifier, so it gives eight bytes: f0 9f 91 8d f0 9f 8f bd. An é typed as e + a combining accent gives 65 cc 81 instead of c3 a9, even though both look the same.
  • Hex is not the same as a Unicode code point. é is code point U+00E9, but its UTF-8 bytes are c3 a9. This tool always shows the bytes.

What the hex to text decoder accepts

In Hex → text mode the tool reads almost any common way of writing bytes:

  • Separators: spaces, line breaks, commas, colons and semicolons, or no separator at all. A continuous string is read two digits at a time.
  • Prefixes: 0x and \x in either case (0X48 and \X48 work) are removed before reading. 0x counts as a prefix only at the start of a byte, so in a0x41 the x sits inside a run of hex digits and the tool reports it as not hexadecimal instead of guessing.
  • Case: 6c and 6C are the same byte.
  • Single digits: a lone digit between separators is read as a byte without its leading zero, so 48 6 gives H followed by the control character 06.

It stops with a message, and no output, when:

Input Message
48 6g This is not hexadecimal: “g” is not 0–9 or A–F.
486 “486” has an odd number of hex digits; each byte needs two.
c3 These bytes are not valid UTF-8 text.
48-69 This is not hexadecimal: “-” is not 0–9 or A–F.

Dashes, % signs (as in %48) and U+ notation are not accepted. For percent-encoded text, use the URL decoder instead. Bytes below 20 decode to control characters that you cannot see in the result box. A 00 byte gives an invisible null (NUL) character, and when the hex contains one the tool adds a note asking whether it is UTF-16: 0048 0069, as copied from a UTF-16 dump or written as code points, decodes to “Hi” with a NUL before each letter, because this tool reads UTF-8 only. A UTF-8 byte order mark at the start (ef bb bf) is kept as the invisible character U+FEFF, with a note saying so, so text → hex → text gives back exactly the same text.

Worked examples

Before Direction After
hello world Text → hex 68 65 6c 6c 6f 20 77 6f 72 6c 64
€ Text → hex e2 82 ac
😀 (Nothing between bytes) Text → hex f09f9880
0x48, 0x65, 0x6c, 0x6c, 0x6f Hex → text Hello
48:65:6C:6C:6F Hex → text Hello
f0 9f 98 80 Hex → text 😀

Line breaks survive the round trip. Two lines become one line of hex with 0a in the middle:

A
B

gives 41 0a 42, and decoding 41 0a 42 gives the two lines back.

When people need hex

  • Debugging encoding problems. When a page shows é instead of é, converting the text to hex shows whether the bytes are c3 a9 (correct UTF-8 read with the wrong encoding) or something else. It also reveals hidden characters: a zero-width space shows up as e2 80 8b, which you can then strip with the invisible character remover.
  • Writing byte arrays and escapes in code. The comma and 0x settings produce a list ready for an array; the \x setting produces a string escape.
  • Reading hex dumps and logs. Network captures, serial-port logs and hex editors show data as hex bytes. Paste a run of bytes to see the text inside.
  • Puzzles and lessons. Hex is a common step in geocaching puzzles, escape rooms and computer science homework on how characters are stored.

Hex, binary, Base64 and URL encoding

All four write the same UTF-8 bytes in a different form. For the word Café:

Encoding Result Use it for
Hex (this tool) 43 61 66 c3 a9 Reading and debugging bytes
Binary é = 11000011 10101001 Teaching how bits work
Base64 Q2Fmw6k= Sending data through text-only channels
URL encoding Caf%C3%A9 Links and query strings

Hex doubles the size of the data (two characters per byte), binary multiplies it by eight, and Base64 adds about a third, which is why Base64 is preferred for transport and hex for inspection.

Questions

How do I convert text to hex?

Paste the text and keep Direction on Text → hex. Each character is turned into its UTF-8 bytes and each byte is written as two hexadecimal digits, so "Hi" becomes 48 69. Copy the result or download it as a .txt file.

How do I convert hex to text?

Choose Hex → text and paste the hex. Spaces, commas, colons, semicolons, line breaks, 0x and \x prefixes are all accepted, and upper- and lowercase digits both work, so 48656c6c6f, 48:65:6C:6C:6F and 0x48, 0x65 all decode.

Why does é become two bytes (c3 a9)?

The tool uses UTF-8, which stores the 128 ASCII characters in one byte and everything else in two, three or four bytes. Accented Latin letters take two, € and most Chinese characters three, and emoji four.

Why do I get "These bytes are not valid UTF-8 text"?

The hex decodes to bytes, but they do not form UTF-8. Usually a multi-byte character was cut short (c3 without its a9), or the hex was made with an older single-byte encoding such as Windows-1252, where é is the single byte e9.

Is hex the same as ASCII code?

For the ASCII characters, yes. The hex byte is the ASCII code written in base 16, so A is 65 in decimal and 41 in hex. Characters outside ASCII have no ASCII code; this tool writes their UTF-8 bytes instead.

Is text to hex a form of encryption?

No. Hex only rewrites the bytes in another notation, and anyone can decode it with no key. To keep text private, use real encryption; for a simple puzzle, the Caesar cipher is a more playful choice.

Is my text sent anywhere?

No. The conversion runs in your browser with JavaScript and the text is not uploaded.