A text to hexadecimal translator converts text into the base-16 representation of its UTF-8 bytes, with exactly two hexadecimal digits for every byte. That byte-first definition is the key to reading the result correctly: it describes the bytes a UTF-8 system receives, not a list of visual character shapes.
The Text To HEX tool performs that conversion in your browser. It accepts the text held by the page field, lets you choose the hexadecimal layout and letter case, and reports the byte count, formatted output length, and any Unicode replacement warnings before you copy the result.

What the translator actually converts
Hexadecimal is a base-16 notation for binary data. A byte has eight bits, so its hexadecimal form needs exactly two digits, from 00 through FF. The translator first produces a UTF-8 byte sequence, then displays one two-digit pair for each byte.
That process differs from displaying Unicode code points or assigning arbitrary numbers to visible characters. One character can require several bytes, while a control character such as NUL still has a defined byte. The tool preserves the content it receives: it does not trim spaces, rewrite line endings, apply case folding to the input, or parse escape sequences.
Use the result when you need to inspect UTF-8 byte values, prepare hexadecimal byte notation, or compare what different characters look like at the byte level. Hexadecimal remains readable encoding, not secret protection.
Output layouts for the same bytes
All three layouts represent one byte array. They differ only in separators and prefixes, so changing the layout does not change the encoded values.
| Layout | Output shape | Useful when | Changes UTF-8 bytes? |
|---|---|---|---|
| Continuous | Two hex digits per byte with no separator | You need a compact byte payload | No |
| Space-separated | Two hex digits per byte with one space between pairs | You need to scan byte boundaries | No |
| 0x-prefixed | A lowercase 0x before every byte and one space between tokens | Your workflow expects labeled hexadecimal tokens | No |
For n bytes, the complete output lengths are 2n for continuous, 3n - 1 for spaced, and 5n - 1 for prefixed output. These formulas count the entire display string, including separator spaces and the lowercase 0x marker. Uppercase output changes only hex letters A through F; it never changes a byte value or the marker.
No delimiter appears before the first token or after the last. Continuous output is the most compact, spaced output makes byte boundaries easier to inspect, and prefixed output fits workflows that label each value as a 0x token.
Encode and copy text as hexadecimal
- Enter the exact text. Type or paste into the input field. Include the spaces, tabs, line breaks, and NUL data that matter; the field can hold NUL, but the tool still applies its stated input-size limit.
- Choose the output syntax. Select continuous pairs, space-separated pairs, or per-byte 0x tokens. Then select lowercase or uppercase hexadecimal digits.
- Run the encoding. Select Encode. The complete text is encoded first, and the required formatted length is calculated before the output string is built.
- Review counts and warnings. Check the UTF-8 byte count and output length. A replacement count means an isolated UTF-16 surrogate was converted to U+FFFD, so the original code unit cannot be recovered from those bytes.
- Copy the entire result. Use the copy control after a successful encode, or select the read-only result manually if clipboard access is denied. Editing the text or options, or starting a new encode, clears the previous output and status.
UTF-8 byte widths and a worked example
UTF-8 uses a variable number of bytes. ASCII characters use one byte, many common Latin characters use two, most characters in the Basic Multilingual Plane use three, and supplementary Unicode scalars use four. Hexadecimal therefore can produce two, four, six, or eight digits for a single character, depending on its UTF-8 width.
Worked example: For the text “Hi,” the UTF-8 bytes are 48 and 69. Continuous output is 4869, spaced output is 48 69, and prefixed output is 0x48 0x69. These are three presentations of the same two bytes.
Byte count and character count are therefore different measurements. The result panel reports the encoded byte count, while the formatted output length also accounts for spaces and prefixes.
Unicode and control-character edge cases
Browser text strings use UTF-16 internally. 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: standard TextEncoder conversion replaces each such code unit with U+FFFD before UTF-8 encoding, producing the bytes EF BF BD. The result panel shows how many replacements occurred. Because decoding those bytes can recover U+FFFD but not the original isolated code unit, a warning matters when exact fidelity is required.
The tool also leaves Unicode sequence structure alone. It does not normalize combining sequences, convert newlines, trim text, case-fold input, interpret escape notation, or rewrite content according to a locale. A combining sequence that is already decomposed remains decomposed. NUL becomes byte 00, while CR, LF, tabs, and spaces are encoded in the order supplied.
No UTF-8 byte order mark is added automatically. If U+FEFF is actually present in the source, it is data and becomes the bytes EF BB BF. An internal U+FEFF remains part of the text. There is one round-trip caveat: the companion Hex to Text Converter consumes a leading byte-order mark under its documented behavior, so an exact return trip through that tool requires the original text not to begin with U+FEFF.
Size limits and complete-output checks
Empty input is rejected, and two explicit budgets determine whether the complete result can be produced.
| Resource | Maximum | Boundary behavior |
|---|---|---|
| Input | 1,000,000 UTF-16 code units | The exact maximum is accepted; one code unit over is rejected before encoding |
| Formatted output | 4,999,999 UTF-16 code units | The exact maximum is accepted; one code unit over is rejected before the output is built |
The input limit counts UTF-16 code units, not visible characters, and the output limit counts UTF-16 code units in the formatted result. Both exact boundaries are accepted; one code unit over either limit is rejected with an explicit message.
Multi-byte Unicode can reach the output budget before the input budget, particularly in spaced or prefixed layouts. In that case the tool reports the failure instead of switching formats, slicing the byte array, dropping a suffix, or sampling the text. The size check happens before the large formatted string is built. For more advice on high-volume inputs, see Text to Hex Bulk: Encoding Large UTF-8 Text Safely.
Local processing and reversible encoding
TextEncoder, sizing, formatting, display, and clipboard preparation all run locally in the current browser tab; the input and output are not uploaded to Lizely. The conversion follows the browser API described in MDN's TextEncoder documentation and the WHATWG UTF-8 encoder definition.
Hex is not hashing, compression, or encryption. Anyone who has the bytes and the UTF-8 rules can reconstruct well-formed text, subject to a decoder's documented leading-BOM behavior. Treat the output as data rather than a password or confidential transport mechanism.
For a practical sequence beyond conversion, use the byte count and warnings as checkpoints, confirm the layout expected by the receiving program, and verify the complete string before moving it onward. This lets you distinguish a text-entry problem from a byte-format mismatch before the hexadecimal value reaches another system.
If you're weighing options, Decode URL Large Text: Handling Long Inputs Safely covers this in detail.