Logo

MonoCalc

/

String to Hex

Encode/Decode

Text Input

Hex Output

About This Tool

🔢 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:

EncodingBytes per ASCII charEmoji example (😀)Best for
UTF-81F0 9F 98 80Modern web, files, APIs (default)
UTF-16 LE23D D8 00 DEWindows apps, .NET, Java internals
UTF-16 BE2D8 3D DE 00Big-endian protocols, Java
ISO-8859-11(not supported)Western European legacy systems
Windows-12521(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:

Delimiter

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).

Prefix Style

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).

Hex Case

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 \x prefix 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.

Frequently Asked Questions

Is the String to Hex free?

Yes, String to Hex is totally free :)

Can I use the String to Hex offline?

Yes, you can install the webapp as PWA.

Is it safe to use String to Hex?

Yes, any data related to String to Hex only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does the String to Hex Converter work?

The tool encodes your input text using the selected character encoding (default UTF-8) and maps each resulting byte to its two-digit hexadecimal representation. For UTF-8 text, this is done with the browser's built-in TextEncoder API — no data is sent to any server.

Why does the same character produce different hex bytes in different encodings?

Each encoding maps characters to bytes differently. In UTF-8, ASCII characters each use one byte, while characters like accented letters or emoji use 2–4 bytes. UTF-16 always uses at least 2 bytes per character. ISO-8859-1 supports only the first 256 Unicode code points.

What do the prefix styles mean?

Prefix styles format each byte for use in different contexts. '\x' is used in C, Python, and JavaScript strings (e.g., \x48). '0x' is common in numeric literals. '%' is the URL-encoding style. 'None' outputs bare hex digits, which is useful for general data representation.

Can I convert hex back to a string?

Yes — use the bidirectional toggle or the companion 'Hex to String' tool. The converter supports swapping direction with one click, letting you decode hex bytes back into readable text using the same encoding settings.

What is the maximum input length?

The tool processes up to 100,000 characters in real time. For inputs larger than 10,000 characters, a performance notice is shown. There is no hard limit, but very large inputs may cause a short processing delay in the browser.

Is my data private?

Completely. All encoding and decoding happens in your browser using the built-in TextEncoder and TextDecoder APIs. Your text is never transmitted to any external server.