🔢 String to Hex Converter – Encode Text as Hexadecimal Bytes
The String to Hex Converter transforms any plain-text string into its hexadecimal byte representation. Whether you are a developer debugging network packets, a security researcher inspecting payloads, or a student learning how text is stored at the byte level, this tool gives you an immediate, accurate, encoding-aware view of how your characters map to hex digits.
🔤 How Text Becomes Hexadecimal
Every character in a string is ultimately stored as one or more bytes. A byte is an 8-bit value ranging from 0 to 255. In hexadecimal (base-16), that value is expressed as two digits using 0–9 and A–F — so a single byte like 72 becomes 48 in hex (because 4×16 + 8 = 72).
The classic ASCII letter H (decimal 72) encodes to 48 in hex. The full word Hello becomes the familiar sequence 48 65 6C 6C 6F. This is the same byte sequence you see in network captures, memory dumps, and binary file viewers.
🌐 Character Encodings Explained
The character encoding controls how each character is converted to bytes before the hex representation is calculated. Different encodings produce different byte sequences for the same input text:
| Encoding | Bytes per ASCII char | Emoji example (😀) | Best for |
|---|---|---|---|
| UTF-8 | 1 | F0 9F 98 80 | Modern web, files, APIs (default) |
| UTF-16 LE | 2 | 3D D8 00 DE | Windows apps, .NET, Java internals |
| UTF-16 BE | 2 | D8 3D DE 00 | Big-endian protocols, Java |
| ISO-8859-1 | 1 | (not supported) | Western European legacy systems |
| Windows-1252 | 1 | (not supported) | Older Windows files and emails |
🎨 Output Format Options
Beyond selecting your encoding, the tool offers several formatting choices that tailor the output for different workflows:
Choose Space for readability (48 65 6C), Colon for Wireshark-style output (48:65:6C), Comma for CSV-friendly format (48,65,6C), Dash for UUID-style grouping, or None for a continuous string (48656C).
None — bare hex digits (48 65 6C). 0x — C/JavaScript numeric literal style (0x48 0x65 0x6C). \x — string escape sequences (\x48\x65\x6C). % — URL-encoded format (%48%65%6C). &#x — HTML numeric character references (H).
Toggle between Uppercase (4F 2A) and Lowercase (4f 2a). Uppercase is the convention in most protocol documentation; lowercase is common in programming contexts.
↔️ Bidirectional Conversion
The ⇄ Swap button toggles the tool between encoding (Text → Hex) and decoding (Hex → Text) modes. In decode mode, the tool automatically strips common prefixes (\x, 0x, %) and delimiters, so you can paste hex strings from any source and get the original text back instantly.
📊 Character Mapping Table
In encoding mode, the Show Table button reveals a detailed per-character breakdown. Each row shows the original character, its hex byte sequence, decimal value, and Unicode code point (e.g., U+0048 for H). Characters that encode to more than one byte — such as accented letters, CJK characters, and emoji — are flagged with a multi badge so you can immediately see where the byte count expands.
💡 Common Use Cases
- Debugging network protocols — Verify that your text is encoded correctly before transmission by comparing the hex output against a packet capture.
- Generating code literals — Use the
\xprefix and None delimiter to produce a ready-to-paste string literal for C, Python, or JavaScript:\x48\x65\x6C\x6C\x6F. - Understanding multibyte encodings — See exactly how many bytes an emoji or CJK character consumes in UTF-8 versus UTF-16.
- Encoding validation — Confirm that accented characters (é, ü, ñ) produce the correct byte sequences under ISO-8859-1 versus UTF-8.
- Security research — Encode payloads in hex for use in shellcode, exploit strings, or fuzzing inputs.
⚡ Performance & Privacy
Conversion happens entirely in your browser using the native TextEncoder Web API. No data is sent to any server. The tool processes up to 100,000 characters in real time; for inputs larger than 10,000 characters a performance notice is shown, but conversion still completes in milliseconds on modern hardware.