Text to hexadecimal conversion represents text as the hexadecimal value of its UTF-8 bytes. Each byte is written with exactly two hexadecimal digits, so the output describes stored bytes rather than a list of character numbers.
That definition is useful when comparing a string with a logged value or the byte sequence behind a payload. It also prevents a common mismatch: a visible accented character or emoji can occupy several UTF-8 bytes. The browser-based Text To HEX performs this byte conversion locally and lets you choose a compact or human-readable layout for the result.

What the hexadecimal result represents
Text To HEX uses the browser TextEncoder API to produce UTF-8 bytes. The number of bytes depends on the character:
- ASCII characters occupy one UTF-8 byte.
- Many common Latin characters occupy two UTF-8 bytes.
- Most characters in the Basic Multilingual Plane occupy three UTF-8 bytes.
- Supplementary Unicode scalar values occupy four UTF-8 bytes.
The conversion follows the WHATWG Encoding Standard’s TextEncoder rules, while MDN’s TextEncoder.encode reference describes the resulting Uint8Array. Text To HEX then formats those bytes as hexadecimal pairs.
A hexadecimal pair is therefore not automatically a Unicode code point, a character position, or a UTF-16 code-unit value. The result is not a list of Windows-1252 bytes, locale-code-page bytes, or an ASCII-only fallback either. It is specifically the hexadecimal representation of the input’s UTF-8 bytes.
Choose a format that fits the destination
The three output formats change presentation, not the underlying byte array. If the encoded result contains n bytes, their formatted lengths are:
| Format | Written form | Formatted length for n bytes | Useful when |
|---|---|---|---|
| Continuous, or plain | Two-digit byte pairs concatenated with no separator | 2n | A compact byte string is needed |
| Space-separated | Two-digit byte pairs joined by one ASCII space | 3n - 1 | Individual bytes need to be easy to inspect |
| 0x-prefixed | 0xNN tokens joined by one ASCII space | 5n - 1 | The destination expects hexadecimal token notation |
There is no delimiter before the first token or after the last one. Uppercase mode changes only the letters A through F; it does not change byte values, and the 0x marker remains lowercase.
For one worked example, the input Hi has the UTF-8 byte pairs 48 and 69. Continuous lowercase output is 4869, space-separated output is 48 69, and prefixed output is 0x48 0x69. All three forms describe exactly the same two bytes.
Convert text to hexadecimal in the browser
Use the encoder when you need a reproducible byte display rather than a character-code list:
- Open the Text To HEX encoder and enter or paste the source text. The browser field can hold Unicode, whitespace, and NUL data that it is able to represent.
- Choose continuous, space-separated, or 0x-prefixed output.
- Choose lowercase or uppercase hexadecimal digits. This control changes only the appearance of letters A through F, not the encoded bytes.
- Select Encode, then review the UTF-8 byte count, formatted output length, and any isolated-surrogate replacement warning.
- Copy the complete read-only output. If clipboard access is denied, the result remains available for manual selection.
Encoding, sizing, formatting, display, and clipboard preparation all run locally in the current browser tab. Neither the input nor the output is uploaded to Lizely.
After you edit the text, change the format or letter case, or begin a new encode, the previous output and its associated error, statistics, warning, and copy state are cleared. This prevents an outdated result from being mistaken for the result of your current settings.
Read the byte count, output length, and warnings
The result panel provides three separate signals that should not be treated as interchangeable:
- UTF-8 byte count reports the size of the encoded byte array after standardized conversion.
- Formatted output length reports the length of the displayed string in UTF-16 code units, including spaces and 0x prefixes.
- Replacement count reports how many isolated UTF-16 surrogate code units were replaced with U+FFFD during conversion.
Byte count describes the encoded data, while formatted output length describes the selected presentation. One visible supplementary character can occupy two UTF-16 code units in the browser input and four UTF-8 bytes in the result, so neither total can be estimated reliably from the number of visible glyphs.
The replacement count deserves particular attention. A nonzero count means the original isolated surrogate code units were not preserved. The visible warning explains why decoding the resulting bytes cannot recreate those original code units.
Understand the input and output limits
Two explicit budgets determine whether the conversion can complete:
- Input: at most 1,000,000 UTF-16 code units. Empty input is rejected before encoding.
- Formatted output: at most 4,999,999 UTF-16 code units, including all separators and prefixes.
- Boundary behavior: the exact limit is accepted, while one input code unit or one output code unit over the corresponding validator is rejected with an explicit message.
- Multi-byte input: Unicode characters that occupy several bytes can reach the output budget before the input budget.
The full text is encoded before formatting, and the required output size is calculated from the byte count and chosen syntax. The limit is checked before the large formatted string is built. If the result is too large, the tool reports the failure instead of switching formats, slicing the byte array, dropping a suffix, or sampling the input.
Formatting proceeds in bounded byte chunks and then joins every chunk. The final length is checked against the predicted value, so a large result is never silently shortened. If your preferred format reaches the output cap first, you may need a more compact presentation rather than a partial conversion.
Preserve whitespace and Unicode details
Byte-level comparison depends on retaining the details that a plain-text display can make easy to overlook:
- NUL, represented by U+0000, becomes the byte 00 and is not treated as a terminator.
- CR, LF, tabs, and spaces are encoded in the order supplied.
- The original character case is retained; the tool does not fold it.
- Combining sequences remain decomposed unless the input was already composed.
No Unicode normalization, newline conversion, trimming, case folding, escape parsing, or locale-aware rewriting is applied. Consequently, a pasted trailing space, a mixed line-ending sequence, and a combining mark remain meaningful parts of the byte representation rather than being cleaned up before encoding.
Handle round trips and the leading U+FEFF caveat
Text To HEX does not add a byte order mark. Ordinary input begins directly with the first character’s bytes. If the input itself begins with U+FEFF, however, that character is encoded as EF BB BF because it is actual input data, not metadata inserted by the encoder. A U+FEFF character elsewhere in the text remains part of that text.
JavaScript strings use UTF-16. A valid high-plus-low surrogate pair represents one supplementary Unicode scalar and is encoded normally. An isolated high or low surrogate is not a Unicode scalar, so the standardized conversion replaces each one with U+FFFD, whose UTF-8 bytes are EF BF BD. The visible replacement count reports this loss of information.
The companion Hex to Text converter consumes a leading EF BB BF under its documented TextDecoder BOM behavior. An exact round trip through that specific tool therefore also requires that the original text not begin with U+FEFF. For well-formed Unicode without that leading-character condition, the UTF-8 bytes can be reversed exactly.
Use the hex output in a debugging workflow
Choose the layout that matches the system or notation you are checking. Continuous output is compact, space-separated output makes individual bytes easier to scan, and 0x-prefixed output fits contexts that already use that token style. Because these are presentation choices, changing layout should never be used to reinterpret the source characters.
- Compare UTF-8 byte sequences when checking accented letters, symbols, emoji, or other non-ASCII content.
- Preserve whitespace and NUL details when the exact payload matters.
- Use the replacement warning as a signal that the source was not entirely well-formed Unicode.
- Match the destination’s uppercase or lowercase convention when its parser is strict about hexadecimal syntax.
Hexadecimal is an encoding display, not encryption, hashing, compression, or secret protection. Anyone with the bytes and the UTF-8 rules can recover well-formed text. Treat the result as a reversible representation for inspection and debugging, and keep the original text whenever byte-level verification is required.
If you're weighing options, Convert to UTF-8 Explained: Characters, Bytes, and Errors covers this in detail.
If you're weighing options, CRC32 Calculator on Android: Text and Hex Steps covers this in detail.