String to Hex Converter — Text to Hexadecimal Bytes Online
Convert any text (UTF-8) to its hexadecimal byte representation. Configurable separator (space / comma / none), lowercase / uppercase, and optional "0x" prefix per byte. Handles emoji, CJK, and every Unicode character correctly. 100% local.
Last updated:
Enter text to get its UTF-8 hexadecimal byte representation. Each byte becomes 2 hex chars — 'A' → '41', '中' → 'e4 b8 ad', '😀' → 'f0 9f 98 80'. Pick separator (space / comma / hyphen / none / newline), case, and optional '0x' prefix.
What is String to Hex?
Text-to-hex is the two-step transformation: text → UTF-8 bytes → 2 hex chars per byte. Getting UTF-8 right matters — legacy 'ASCII to hex' tools produce nonsense for any character outside 0–127 (accents, CJK, emoji). This tool uses the browser's built-in TextEncoder for a fully Unicode-conformant UTF-8 encoding, then formats each byte as a 2-digit hex number. The output is byte-for-byte identical to what you'd get from Python's `text.encode('utf-8').hex()`, Node's `Buffer.from(text, 'utf8').toString('hex')`, and Go's `hex.EncodeToString([]byte(text))`.
How to convert text to hex online
- 1Paste text into the input pane.
- 2Pick a byte separator (single space is the most common; 'none' produces a continuous hex string).
- 3Choose lowercase (default, matches Python / Node convention) or uppercase.
- 4Optionally add '0x' prefix per byte — handy when copying into C-style array literals.
Use Cases
Inspect what a database is really storing
See exactly which bytes VARCHAR is going to store — critical when a column mixes emoji, CJK, and Latin-1 legacy data.
Build test fixtures for byte-level protocols
Generate exact hex payloads for network / device tests — copy directly into a Wireshark, netcat, or Postman raw body.
Debug encoding mismatches
When a string looks wrong on the wire, comparing the actual hex against the expected reveals whether it was double-encoded, wrong-encoded (Latin-1 vs UTF-8), or truncated.
Prepare data for hash / signature demos
Every crypto library operates on bytes. Getting a canonical hex representation lets you paste into openssl, sha256sum, or a REPL.
Key Concepts
- UTF-8
- The dominant Unicode encoding on the web. Variable-length: 1 byte for ASCII, 2 for most Latin extended, 3 for CJK, 4 for emoji and rare scripts.
- Hex byte
- 2 hexadecimal digits (00–FF) representing 8 bits of raw data — the standard human-readable format for binary content.
Tips & Best Practices
- ▸The 'none' separator with lowercase is the format Python's `.hex()` uses — great for comparing outputs across languages.
- ▸For debugging, put emoji at the start of your input — you'll immediately see 4-byte UTF-8 sequences and can visually confirm the tool works.
- ▸If you need Latin-1 (single-byte) encoding for legacy protocol interop, this tool can't do it; use a Python REPL. UTF-8 has been the correct default since 1993.
- ▸The reverse tool (Hex to String) accepts every separator format — round-tripping is free.
Frequently Asked Questions
How is text turned into hex?
The text is first encoded as UTF-8 (the modern default), then each byte becomes a 2-digit hex number. So 'A' (U+0041) → '41', 'é' (U+00E9) → 'c3 a9' (2 bytes), '😀' (U+1F600) → 'f0 9f 98 80' (4 bytes).
Is this the same as ASCII to hex?
For characters in the ASCII range (0–127), UTF-8 and ASCII produce identical hex. For anything beyond that — accents, CJK, emoji — UTF-8 uses 2–4 bytes per character. Pure ASCII-to-hex tools break on such input; this one doesn't.
Can I get output without any separator?
Yes — pick 'none' as the separator to get a continuous hex string like '48656c6c6f'. Or pick space, comma, hyphen, or newline.
Does uppercase / lowercase matter?
For decoding, no — the reverse tool accepts both. For readability and machine parsing, lowercase is the most common convention (matches Python's .hex() and Node's Buffer.toString('hex')).
Related Tools
Regex Tester
Test regular expressions online. Live match highlighting, capture groups, and support for JavaScript flags (g, i, m, s, u, y).
Regex Replace
Find and replace text with a regular expression online. Supports every JavaScript flag (g, i, m, s, u, y), all backreferences ($1..$9, $&, $`, $', $<name>), and escape sequences (\n, \t) in the replacement. Live match-by-match preview and diff. 100% local.
Text to Speech
Convert text to spoken audio using your browser's built-in Speech Synthesis API. Pick from all voices installed on your OS, adjust rate, pitch, and volume. No account, no download, no upload — 100% local.
XML Formatter
Format, beautify, and validate XML documents online. Handles namespaces, CDATA sections, and mixed content.
SQL Formatter
Format and beautify SQL queries. Supports SELECT, JOIN, subqueries, CTEs, and multiple SQL dialects.
Case Converter
Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.