Skip to main content
  • Pricing
Tutorials

Hex to Text: Decode UTF-8 Bytes by Hand

By Oakgen TeamPublished 1 min read

Share
Hex to Text: Decode UTF-8 Bytes by Hand

Hexadecimal represents each byte with two characters, using 0โ€“9 and Aโ€“F. To decode it as text, first recover the bytes and then interpret them using an encoding such as UTF-8. The encoding matters because the hexadecimal string by itself carries bytes rather than a language.

Decode a short string

Take 48 65 6C 6C 6F. Removing the separating spaces leaves ten digits. Split them into pairs: 48, 65, 6C, 6C, 6F. In UTF-8 those five bytes spell Hello.

A single character can use more than one byte. The UTF-8 representation of รฉ is C3 A9, so reading the two bytes as two independent characters would produce the wrong result.

Find the source of an error

Check the format before decoding. A single leading 0x might be a prefix, and spaces might be separators, depending on where the input came from. Once you remove the intended formatting, reject anything outside the hexadecimal alphabet and stop if the digit count is odd. Adding a zero silently changes the message. If the byte layout is valid but UTF-8 fails, the data could use a different encoding or represent a binary file. Keep the original bytes until you can identify the source format.

Continue with Oakgen Agent

Coming soon: A dedicated in-page hex-to-text converter.

Open in Oakgen Agent

The prompt is filled in for you. Review it before sending.

Open in Oakgen Agent

Sources

  1. IETF RFC 4648, hexadecimal and Base-N encodings
  2. IETF RFC 3629, UTF-8
Share