↑ ↓ to moveEnter to openEsc to close

Text to hex converter

Type or paste text to see its bytes in hex, updated on every keystroke. Pick the encoding and the output style your code expects.

Character by character

 

What you're seeing

Every character you type is stored as one or more bytes, and this tool shows those bytes in hexadecimal as you type. Plain English letters map one to one: "Hi" is 48 69. Anything beyond basic ASCII takes more bytes, and the count under the output shows how many.

Try the default text, Café ☕:

CharacterCode pointUTF-8 bytes
CU+004343
aU+006161
fU+006666
éU+00E9C3 A9
(space)U+002020
☕U+2615E2 98 95

That's six characters but nine bytes. The per-character panel lists every character with its code point, so you can see which ones are multi-byte.

Encodings

UTF-8 is what you want nine times out of ten. It's the encoding of the web, of JSON, of most source files and of Linux and macOS filenames.

UTF-16 stores most characters in two bytes. Choose:

  • BE (big-endian), where the high byte comes first: é becomes 00 E9;
  • LE (little-endian), where the low byte comes first: é becomes E9 00.

Windows APIs, .NET and Java strings, and JavaScript's internal strings use UTF-16, usually little-endian on disk. In UTF-16 the Café ☕ example is 12 bytes. Characters outside the Basic Multilingual Plane, such as most emoji, become a surrogate pair of four bytes. 😀 is D8 3D DE 00 in UTF-16 BE.

Output styles

StyleLooks likeUse it for
Spaced43 61 66reading, docs, comparing with hex editors
Plain436166hashes, database literals (X'436166' in SQL)
0x list0x43, 0x61, 0x66array initializers in C, C++, Rust, Python
Escaped\x43\x61\x66string literals in C, Python, JavaScript, shell printf
C arrayconst unsigned char data[3] = {…};embedding data in firmware or C code
URL%43%61%66percent-encoding a query parameter

Tick lowercase if your codebase or tool expects c3 a9 rather than C3 A9. Both mean the same thing.

Typical uses

  • Debugging encoding bugs. If a database shows "é" where you expected "é", compare the stored bytes with what UTF-8 should produce.
  • Writing test fixtures with exact bytes, including emoji and right-to-left text.
  • Firmware and embedded work, where strings are stored as byte arrays.
  • Checking string length limits. A 255-byte column fills up faster than you'd think with non-Latin scripts, since each Chinese, Japanese or Korean character is three bytes in UTF-8.
  • Escaping awkward characters in a shell command or a regular expression.

Hidden characters

Copying text from a web page or a word processor can bring invisible extras. The per-character list makes them visible:

  • U+00A0, a non-breaking space (C2 A0 in UTF-8), instead of a normal space;
  • U+200B, a zero-width space (E2 80 8B);
  • U+FEFF, a byte order mark (EF BB BF) at the start of the text;
  • curly quotes (U+201C and U+201D) where code expects straight ".

If a string "looks right" but fails a comparison, one of these is the usual culprit.

Hex or Base64?

Hex is easy to read but doubles the size: every byte becomes two characters. Base64 packs three bytes into four characters, a third bigger than the original. For the nine-byte Café ☕ example, that's 18 hex characters against 12 in Base64.

Choose hex when people need to read or compare the bytes, as in logs, bug reports, protocol docs and checksums. Choose Base64 when the data just has to travel safely through text, such as email attachments, data URLs and JSON payloads.

A quick check in a terminal: printf 'Café' | xxd on macOS or Linux prints the same bytes this tool shows.

Decode bytes back into text with hex to text, which also flags invalid sequences. To see each byte's bits, use hex to binary. For a single number rather than text, use decimal to hex.

FAQ

Why is my emoji 4 bytes but some show as 7 or more?

Many emoji are sequences: a base character plus a variation selector (U+FE0F), a skin-tone modifier, or several people joined with zero-width joiners. The family emoji 👨‍👩‍👧 is five code points and 18 bytes in UTF-8.

Does it work for any language?

Yes. UTF-8 and UTF-16 cover all of Unicode, including scripts like Arabic, Devanagari and Chinese.

Is the text sent anywhere?

No. Encoding happens in your browser with the built-in TextEncoder.