Overview
Introduction
Hexadecimal is the standard way developer tools display character codes and byte values.
This tool converts text to its hex code points directly.
What Is String to Hex Converter?
A converter that encodes each character's Unicode code point as a base-16 number, zero-padded to at least 2 digits, space-separated.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How String to Hex Converter Works
Each character's code point is converted to base-16 and left-padded with zeros to at least 2 digits.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use String to Hex Converter
Use it to look up a character's hex code point, or generate hex-encoded text for debugging or puzzles.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Hex to String Converter and String to Decimal Converter.
Features
Advantages
- Matches the format most debuggers and Unicode references use.
- Consistent 2-digit padding for ASCII, with wider digits for larger code points.
- Pads to a minimum of two digits, so ASCII text lines up in even columns while larger code points are still printed completely.
Limitations
- Represents code points, not UTF-8 byte values.
- Omits the U+ prefix and does not pad to four digits, so the output does not directly match the notation used in Unicode charts.
Examples
Best Practices & Notes
Best Practices
- Use Convert a String to Bytes first if you need a true UTF-8 byte-level hex dump instead of code points.
- Keep the space separators, since tokens vary in width once the text moves beyond ASCII and cannot otherwise be split apart again.
- Use the Bytes converter when producing a hex dump to compare against a file, because a file stores UTF-8 bytes rather than code points.
Developer Notes
This is a thin wrapper around a shared radix-encoding helper called with radix 16 and a minimum padding width of 2.
String to Hex Converter Use Cases
- Looking up a character's hex code point for debugging
- Generating hex-encoded text for a puzzle or exercise
- Cross-referencing text against a hex-based reference table
Common Mistakes
- Assuming this represents UTF-8 byte values rather than Unicode code points.
- Comparing this output against a hex editor's view of the same text, which shows UTF-8 bytes and diverges above 0x7F.
Tips
- Use Convert Hex to a String to decode the result back to text.
- Hex 20 is a space and 0A a newline, so those two values account for a large share of the tokens in ordinary prose.