Home Tools Blog About

Convert Text to Hex

In short

Convert text to hex (UTF-8) and back with per-character breakdown. 4 separator formats. Free, offline, client-side, instant, secure.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Convert text to hex (and back) using proper UTF-8 encoding via the browser's TextEncoder. Per-character grid shows codepoint, byte count, hex, and binary for every input character. Emoji and non-ASCII characters expand into their multi-byte UTF-8 sequences visibly.

Per-character breakdown

Type to begin.
🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Convert Text to Hex

  1. Type or paste text. ASCII letters work, but so do emoji 😀, accented é, CJK 你好, Arabic ‫مرحبا‬, math symbols ∑. UTF-8 encoding via TextEncoder produces correct multi-byte sequences for every codepoint.
  2. Choose a separator. Space-separated (48 65 6C 6C 6F) matches hex dumps. Comma for CSV-style data. Continuous (no separator) for raw byte strings. 0x-prefixed (0x48 0x65) for pasting straight into C, Rust, or Python source.
  3. Toggle uppercase or lowercase. Default uppercase matches most hex dump conventions (hexdump -C, Windows tools). Lowercase is common in C/Rust source. Mathematically identical bytes; the choice is stylistic.
  4. Read the per-character grid. One row per Unicode codepoint showing the codepoint number (U+0041), the UTF-8 byte count, hex bytes, and binary bytes. Multi-byte characters jump out: é shows 2 bytes, 😀 shows 4.
  5. Swap for reverse. ⇄ flips to Hex → Text. The parser accepts 48 65 6C 6C 6F, 0x48 0x65, 48656C6C6F, 48,65 - strips prefixes and separators, validates pairs, decodes strict UTF-8.
  6. Batch mode. Multiple lines = TSV with Input / Hex / Bytes / Chars columns. Download as .tsv opens in Excel/Sheets with proper columns. Errors get an ERROR row so one bad line doesn't break the batch.
  7. Stats summarize the encoding. Chars vs bytes vs multi-byte count tells you instantly whether your input has non-ASCII. chars=5 · bytes=5 = pure ASCII; chars=7 · bytes=11 · multi-byte=2 = 2 emoji/accented characters expanded the byte count.

Frequently Asked Questions

Does it handle emoji correctly?

Yes. The tool iterates Unicode codepoints (using for…of) so surrogate pairs for high codepoints stay together. 😀 (U+1F600) encodes as the 4-byte UTF-8 sequence F0 9F 98 80, shown as one row in the grid. Older converters use charCodeAt which returns UTF-16 code units and produces wrong hex for anything above U+007F.

Can I convert hex back to text?

Yes – click Swap. The reverse parser is lenient about input formatting: 48 65 6C 6C 6F, 0x48 0x65 0x6C 0x6C 0x6F, 48,65,6C,6C,6F, and 48656C6C6F all decode to Hello. Odd-digit input gives “Hex must have even digit count”; non-hex characters give “Invalid hex digit ‘X’ at position N”.

What does strict UTF-8 decoding mean?

The decoder uses {fatal: true} mode, which throws when bytes don’t form valid UTF-8 – for example a lone continuation byte 80 with no lead byte, or an overlong encoding. Non-strict decoders silently substitute the U+FFFD replacement character ("�") and hide the problem. Strict mode surfaces data corruption instead.

Which separator should I use?

Match your destination. Hex dumps: space. CSV imports: comma. Raw byte strings: continuous (no separator). C/C++/Rust source literals: 0x-prefixed, paste straight as {0x48, 0x65, 0x6C, 0x6C, 0x6F}. The underlying bytes are identical; only display differs.

Uppercase vs lowercase – does it matter?

Mathematically no – 4F and 4f are the same byte (79). The choice is stylistic. Unix tools (od, xxd) default to lowercase. Windows hex editors and macOS Hex Fiend default to uppercase. C/Rust source typically uses lowercase. Pick whichever your codebase uses.

What’s the input size limit?

200,000 characters. Beyond that the per-character grid renders too slowly (each row is a DOM node). Hit the cap and you get a specific error message. The grid itself caps at 256 displayed rows with a “… N more” note, but conversion still processes the full input.

How does the grid show whitespace?

The Char column substitutes visible glyphs so rows aren’t blank: space → · (middle dot), newline → ↵, tab → →. The actual encoded bytes (20, 0A, 09) appear correctly in the Hex and Binary columns. Useful when auditing what’s actually in your text.

Is there a difference between this and the “String to Hex” tool?

Functionally they’re equivalent – both convert text to UTF-8 hex and back with per-character analysis. They exist as separate URLs because “string” and “text” are different SEO keywords people search for, even though they mean the same thing in this context.

Is my input uploaded anywhere?

No. All UTF-8 encoding, hex formatting, decoding, and TSV emission run in your browser using TextEncoder/TextDecoder. Open DevTools → Network and confirm zero requests – even when you Convert or Download. Safe for sensitive text, credentials, or anything you’d rather not send to a third-party converter.

Does it work offline?

Yes. Total bundle is about 18 KB. Load once, disconnect, keep using. Pure local computation – no fonts to fetch, no analytics, no API. Useful for offline debugging, airgapped environments, or when you don’t trust the network you’re on.

Keep going

Related Tools

All Hex tools →
Share

Embed this tool

Add this free tool to your website. Copy and paste the code: