A text to hex string converter produces the hexadecimal representation of text’s UTF-8 bytes, with exactly two hexadecimal digits per byte.
Use it to inspect or exchange the byte sequence behind a string, such as preparing a UTF-8 payload for a technical workflow or checking how whitespace and non-ASCII characters are represented. The Text To HEX converter runs locally in the current browser tab and offers continuous, space-separated, and 0x-prefixed output.

What the converter encodes
Text is first interpreted as Unicode and then encoded as UTF-8. ASCII characters occupy one byte, many common Latin characters occupy two, most characters in the Basic Multilingual Plane occupy three, and supplementary Unicode scalars occupy four. The hexadecimal output length therefore follows the UTF-8 byte count, not the number of visible characters.
Each UTF-8 byte is rendered with two hexadecimal digits. Every pair has the same width, including values below 16, which require a leading zero. The tool represents UTF-8 bytes rather than UTF-16 code-unit values, Unicode code-point notation, ASCII-only fallback text, Windows-1252, or a locale-dependent code page.
Formatting changes how the bytes are displayed, not which bytes they are. That distinction matters when a downstream parser expects a particular separator or token syntax.
Choose a hex string layout
All three output formats contain the same UTF-8 byte array. Choose the layout required by the destination:
| Format | Exact layout | Length for n UTF-8 bytes | Useful when |
|---|---|---|---|
| Continuous | Two-digit byte pairs joined with no delimiter | 2n | A destination expects one unbroken hexadecimal field |
| Space-separated | Two-digit pairs separated by one ASCII space | 3n − 1 | Byte boundaries need to be visible during review |
| 0x-prefixed | Per-byte 0xNN tokens separated by one ASCII space | 5n − 1 | Code or a data format uses 0x-style byte tokens |
Here, n is the UTF-8 byte count, not the input character count. Uppercase mode changes only the hexadecimal letters A–F; digits and the lowercase 0x prefix marker remain unchanged. Changing the layout can change the formatted output length, but it never changes the encoded byte values.
Convert a string in four actions
- Enter the original text. Paste or type the text exactly as it should be represented. The browser field can hold Unicode, whitespace, and NUL data, so preserve leading or trailing spaces, tabs, and line breaks.
- Select the output layout and letter case. Choose continuous pairs, space-separated pairs, or per-byte 0xNN tokens, then select lowercase or uppercase hexadecimal letters.
- Select Encode. The converter encodes the complete text as UTF-8, validates the input, and calculates the formatted output size before constructing a large result.
- Review and copy the result. Check the UTF-8 byte count, formatted output length, and replacement count, then copy the complete hexadecimal output. If clipboard permission is denied, the read-only result remains available for manual selection.
Editing the text, changing the format or case, or starting another encode clears the previous result and copy state. This prevents an outdated conversion from being mistaken for the current one.
Follow one complete conversion
Worked example: Enter “café.” The ASCII characters c, a, and f contribute the bytes 63, 61, and 66, while é contributes the two UTF-8 bytes C3 and A9. The complete byte sequence is 63 61 66 C3 A9. Continuous output is 636166C3A9, space-separated output is 63 61 66 C3 A9, and 0x-prefixed output is 0x63 0x61 0x66 0xC3 0xA9. The bytes and their order are identical in all three presentations.
Preserve Unicode and whitespace exactly
The converter does not normalize Unicode, convert newlines, trim whitespace, fold case, parse escape sequences, or apply locale-aware rewriting. A combining sequence remains decomposed unless the input was already composed. It also does not treat NUL or other data as a terminator: NUL becomes the single UTF-8 byte 00, while CR, LF, tabs, and spaces are encoded in the order supplied.
TextEncoder does not add a UTF-8 BOM. If the original text begins with U+FEFF, that character is data and is encoded as EF BB BF. An internal U+FEFF is also preserved. The companion Hex to Text converter consumes a leading EF BB BF under its documented BOM behavior, so an exact round trip through that specific decoder requires the original not to begin with U+FEFF.
Browser text is held as a JavaScript UTF-16 string. A valid high-plus-low surrogate pair represents one supplementary Unicode scalar and encodes normally. An isolated high or low surrogate is not a Unicode scalar; standardized TextEncoder conversion replaces each one with U+FFFD, encoded as EF BF BD. The result reports a replacement count because decoding those bytes cannot recreate the original isolated code unit. Exact round trips require well-formed Unicode, plus the leading-U+FEFF caveat above.
The WHATWG TextEncoder encode definition specifies this UTF-8 conversion, while MDN’s TextEncoder.encode documentation describes the browser API and its Uint8Array output.
Plan around input and output limits
Input is capped at 1,000,000 UTF-16 code units, and empty input is rejected. This is not exactly a visible-character limit: supplementary characters use a surrogate pair in a JavaScript string, and multi-byte characters can consume more of the output budget than their displayed count suggests. The input limit is checked before encoding.
The formatted result is capped at 4,999,999 UTF-16 code units. The exact boundary is accepted; one code unit over either maximum produces an explicit rejection. For n UTF-8 bytes, the predicted lengths are 2n for continuous output, 3n − 1 for spaced output, and 5n − 1 for 0x-prefixed output. Multi-byte Unicode can therefore reach the output limit before the input limit.
The tool encodes the full text and calculates the required formatted size before building a large string. If that prediction exceeds the cap, it reports failure instead of switching formats, slicing bytes, dropping a suffix, or sampling the content. Formatting proceeds in bounded chunks and joins every chunk, after which the final length is checked against the prediction. Chunking reduces temporary allocation without shortening the result.
Verify and copy the result
After encoding, check the UTF-8 byte count, formatted output length, and replacement count before copying. A nonzero replacement count means the result is not an exact representation of the original isolated surrogate. If clipboard access is denied, select the complete read-only result manually rather than relying on a partial or outdated copy status.
To verify a well-formed round trip, copy every byte and use the Hex to Text Converter with expectations that match the separators or 0x prefixes. Keep the leading-U+FEFF caveat in mind: the companion decoder consumes a leading BOM, so text that intentionally starts with U+FEFF may not emerge identically through that specific tool.
Separate encoding from security
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. The conversion, sizing, formatting, display, and clipboard preparation happen locally in the current browser tab; neither the input nor the output is uploaded to Lizely. Local processing reduces data transfer, but it does not make encoded content confidential.
If you're weighing options, Text to Unicode: Convert Text to U+ Code Points covers this in detail.
If you're weighing options, Convert to UTF-8 Encoding: Validate, Preview, Download covers this in detail.