0xCONVERTER-HEX

Bytes → UTF-8 text

Hex to Text Converter

Decode hexadecimal into text using UTF-8 — the encoding almost everything modern actually uses.

Hexadecimal in

Text

Byte values

Text is not the same as ASCII

If your bytes only ever run from 00 to 7F, this converter and the hex to ASCII converter give identical answers. The difference appears the moment a byte goes higher — and in real data, it does.

ASCII defines 128 codes and nothing else. UTF-8 covers every character in Unicode, using one byte for the ASCII range and two, three or four bytes for everything beyond it. Since UTF-8 is the default for the web, JSON, modern source files and most APIs, it is the right assumption for anything that is not specifically old.

How UTF-8 encodes a character

The number of bytes is signalled by the leading bits of the first byte, so a decoder always knows how many bytes to read next without any separator.

BytesFirst byte patternCoversExample
10xxxxxxxASCII, U+0000–U+007FA = 41
2110xxxxxLatin accents, Greek, Cyrillic, Hebrew, Arabicé = C3 A9
31110xxxxMost CJK, Indic scripts, symbols世 = E4 B8 96
411110xxxEmoji, rare scripts, historic characters😀 = F0 9F 98 80
Why this design is clever

A byte starting with 0 is always a standalone ASCII character, and a byte starting with 10 is always a continuation. That means a decoder can find the start of a character from anywhere in the stream, and pure ASCII text is valid UTF-8 unchanged.

Worked example

48656C6C6F20E4B896E7958C

  48        → H
  65        → e
  6C        → l
  6C        → l
  6F        → o
  20        → (space)
  E4 B8 96  → 世    three bytes, one character
  E7 95 8C  → 界    three bytes, one character

  result → Hello 世界   — 12 bytes, 8 characters

Note the mismatch in the last line. Bytes and characters are not the same count in UTF-8, which is why string length is a surprisingly subtle question in any language that stores text this way.

When decoding fails

Not every byte sequence is valid UTF-8. A continuation byte with no lead byte, a lead byte promising more bytes than are present, or an overlong encoding are all rejected rather than guessed at. This converter reports the failure instead of substituting question marks, because a failure is useful information.

If your bytes will not decode, one of these is usually true:

  • The data is not text at all — you are looking at a header, a length field or compressed bytes.
  • The encoding is Latin-1 or Windows-1252, common in older Windows files and legacy databases.
  • The byte order is wrong, or you started reading from the middle of a character.
  • A byte-order mark (EF BB BF) is present at the start, which is valid but often unexpected.

Bytes, characters and why the count differs

TextBytes in UTF-8CharactersHex
A1141
é21C3 A9
31E4 B8 96
😀41F0 9F 98 80
café5463 61 66 C3 A9

The last row is the practical one. A four-character word taking five bytes is exactly why truncating a string by byte count can split a character in half and corrupt the output.

Frequently asked questions

What is the difference between hex to text and hex to ASCII?

This page decodes as UTF-8, which covers every Unicode character. The ASCII converter handles only codes 0 to 127. For bytes in that range both give the same answer.

Why does one character take several bytes?

UTF-8 uses one byte for ASCII and two, three or four for everything else. The leading bits of the first byte say how many follow.

Why does my hex fail to decode?

The bytes are not valid UTF-8. They may be Latin-1 text, binary data rather than text, or a sequence starting from the middle of a character.

What is EF BB BF at the start of my data?

A UTF-8 byte-order mark. It is valid and marks the file as UTF-8, but many tools do not expect it and treat it as a stray character.

How many bytes is an emoji?

Four in UTF-8 for most emoji. Some are sequences of several code points joined together, which can run to a dozen bytes or more.

Does UTF-8 change ASCII text?

No. Every ASCII character encodes to the same single byte in UTF-8, which is why the two formats are compatible for plain English text.