Hex Text Converter

Convert text to hex bytes and hex back to text

Encodes each UTF-8 byte of your text as two hexadecimal digits, and decodes a hex string back to readable text. Handles multibyte characters and emoji correctly, with clear errors on malformed hex. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is text converted to hex?

The text is encoded as UTF-8 bytes, and each byte (0 to 255) is written as exactly two hexadecimal digits. The letter A is byte 65, which is 41 in hex. A space is byte 32, which is 20.

Hexadecimal is the standard compact way to show raw bytes. This converter turns text into a UTF-8 hex byte stream and decodes hex back into readable text.

How it works

For encoding, the text is converted to UTF-8 bytes. Each byte from 0 to 255 is written as two hex digits:

byte 65 (A)  -> 41
byte 32 ( )  -> 20
byte 255     -> FF

For decoding, the input is normalised by stripping whitespace and any 0x prefixes, then the digits are read in pairs. Each pair is parsed as a byte and the byte array is decoded as UTF-8 into the original text.

Example and notes

The word Hi is bytes 72 and 105, giving hex 48 69. ASCII characters are always two hex digits; characters beyond ASCII use several UTF-8 bytes and so appear as several hex pairs. When decoding, the total number of hex digits must be even — an odd count means a byte is incomplete, so the tool flags it instead of dropping a nibble.


Why hex is used for text bytes

Hex notation exists because it maps cleanly onto binary: each hex digit represents exactly 4 bits (a “nibble”), so two hex digits represent exactly one byte (8 bits). This 1:2 relationship makes hex far easier to read and compare than raw binary (0s and 1s), while remaining unambiguous about the underlying byte value.

When you see a hex dump in a debugger, a network sniffer, or a binary file editor, you are looking at exactly what this tool produces: the raw byte values of each character in the string, expressed as pairs of hex digits.

UTF-8 and multi-byte characters

ASCII characters (A–Z, a–z, 0–9, punctuation) map to bytes 0–127, which fit in a single byte and appear as two hex digits. For example:

CharacterUTF-8 byte(s)Hex
A6541
z1227A
Space3220

Non-ASCII characters use multiple UTF-8 bytes, so they produce more hex pairs:

CharacterUTF-8 byte(s)Hex
é (e acute)195, 169C3 A9
£ (pound sign)194, 163C2 A3
☺ (smiley)226, 152, 186E2 98 BA
😀 (emoji)240, 159, 152, 128F0 9F 98 80

This is why a simple string like “café” produces 5 hex pairs rather than 4 — the accented é takes two bytes.

Common use cases for hex-text conversion

  • Debugging protocol buffers or binary protocols: when you capture network traffic, the payload arrives as bytes. Converting known text fields to hex lets you locate them inside the raw byte dump by searching for the hex representation.
  • Escaping and encoding research: when investigating how a string is actually stored versus how it is displayed, hex makes the byte-level structure unambiguous. This is especially useful when diagnosing encoding bugs between systems that disagree on character sets.
  • Colour codes and file signatures: hex is the universal notation for colour values (#FF5733) and file magic bytes (a PNG file always starts with 89 50 4E 47 0D 0A 1A 0A). While this tool focuses on text-to-hex, the same numeric system underlies those values.
  • Embedding binary data in source code: hex string literals ("\x48\x69" for “Hi”) appear in C, Python, and other languages for hard-coded byte sequences. This tool lets you convert the text string to get the hex values to embed.

Encoding vs. encryption

Hex encoding is not encryption. The conversion is trivially reversible — anyone with a hex decoder (including this tool) can reconstruct the original text. Do not use hex encoding to obscure sensitive data. For actual security, use proper encryption; hex is purely a display format for bytes.