b2KIT

Hex Encoder / Decoder

Convert text to hexadecimal representation and decode hex strings back to readable text or binary data.

Tested tool guide Tested browser tools Checked August 16, 2026

What Hex Encoder / Decoder does, with a checked example

Hex Encoder / Decoder moves between text or byte values and base-16 notation. In encode mode, every byte is written as two hexadecimal digits. In decode mode, each digit pair is restored to one byte and, when applicable, interpreted as text. For example, the byte value 65 is written as 41. The important surprise is that hexadecimal describes bytes, not visual characters. ASCII characters occupy one byte in UTF-8, but accented letters, emoji, and many other characters occupy multiple bytes.

Worked example

A concrete input and expected output from the current implementation.

Input

A

Expected output

41

Capital A has byte value 65 in both ASCII and UTF-8. Decimal 65 is hexadecimal 41, so its single byte becomes exactly two hex digits.

How the result is produced

1

Encoding bytes

During encoding, each byte is split into two four-bit values. Values zero through fifteen are written with 0-9 and A-F, producing exactly two hex digits per byte. A leading zero is significant: byte 5 is 05, not 5. Letter case does not change the numeric value, so 4a and 4A denote the same byte.

2

Decoding pairs

Decoding reverses the mapping by grouping hexadecimal digits into pairs. Each pair from 00 through FF becomes one byte, so a complete byte sequence needs an even number of digits. Displaying those recovered bytes as text also requires a character encoding. If the bytes represent non-text data or an incompatible encoding, the result may not be readable.

Good uses

  • Check the exact bytes produced by a short UTF-8 string before placing it in a protocol message, test vector, or byte-oriented configuration.
  • Turn a hex field copied from a packet trace, firmware note, or application log into text to see whether it contains an identifier or message.
  • Create or verify byte fixtures such as magic numbers, delimiters, null bytes, and ASCII command sequences without manually converting every value.

Limits and checks

  • A hex string contains no character-set label. The same bytes can display differently under different encodings, and arbitrary bytes may not form valid text at all.
  • A complete byte representation needs two hex digits per byte. An odd-length value leaves half a byte, while non-hex characters can make input invalid unless they are accepted as separators.
  • Hexadecimal is a representation, not encryption or compression. It exposes every original byte and normally uses two text characters for each byte, before separators or prefixes.

Common questions

Why does one emoji become several hex pairs?

Characters and bytes are not interchangeable. In UTF-8, U+1F600, the grinning face, is encoded by four bytes: F0 9F 98 80. Hex writes those bytes separately, yielding F09F9880 when separators are omitted. This does not mean the input contains four characters. It means one Unicode code point required four UTF-8 bytes.

Can every hex string be decoded into readable text?

No. Every complete valid hex pair can describe a byte, but not every byte sequence is valid text in the intended character encoding. Image, executable, compressed, and encrypted data will usually remain binary. Even genuine text can appear wrong if decoded with a different encoding from the one used to produce its bytes.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools