String to Hex

Convert text to hexadecimal bytes and hex back to text.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

String to Hex Converter – Hex to String Online

Convert a string to hexadecimal and hex back to a string in one place. Type text on the left and get its bytes as hex digits, e.g. Hello → 48656c6c6f; switch direction to decode a hex string from a log file, an API response, or source code into readable text.

Why developers use hex strings

Hexadecimal is the standard way to write bytes: each byte from 0 to 255 becomes exactly two characters from 00 to ff. That makes hex compact, unambiguous, and easy to align, so it appears in hash values, cryptographic keys, cookies, database BLOB columns, packet captures, and escape sequences such as \x41. Converting a string to hex lets you see what is actually inside it – trailing spaces, line breaks, or characters that look identical but have different codes.

How the conversion works

The string is encoded as UTF-8 first, then each byte is written in base 16. ASCII characters map to a single byte, so A is 41 and a space is 20. Characters outside ASCII use more bytes: ü becomes c3bc, ß becomes c39f, and the waving-hand emoji becomes f09f918b. Decoding reverses the process and checks that the bytes form valid UTF-8, so a truncated or corrupted hex string is reported rather than silently turned into garbage.

Output options

  • Separator – no separator for a compact string (48656c6c6f), or spaces, commas, or new lines to keep bytes readable.
  • Uppercase – 4A instead of 4a, as used in many specifications and hex editors.
  • 0x prefix – writes every byte as 0x48, ready for a C, Java, or JavaScript array initialiser.
  • Decode as – read the bytes as UTF-8 (default) or as single-byte Latin-1.

Examples

  • Hi! → 486921 → 48 69 21 with spaces → 0x48 0x69 0x21 with prefix.
  • \x48\x65\x6c\x6c\x6f and %48%65%6C%6C%6F both decode to Hello.

For hex dumps with a focus on UTF-8 validation, see Hex to UTF-8; to write the same bytes as ones and zeros, try Text to Binary.

Frequently Asked Questions

Each byte is written with two hex digits (00–FF), so a plain ASCII string always becomes exactly twice as long. Non-ASCII characters take several bytes in UTF-8: ü becomes c3bc and 👋 becomes f09f918b, so they add four to eight hex digits each.

A continuous string (48656c6c6f), bytes separated by spaces, commas, colons, or dashes (48:65:6c), bytes with 0x or \x prefixes, and percent-encoded bytes (%48%65). Upper and lower case are both fine.

Use Latin-1 when the hex came from an older system that stores one byte per character, such as legacy databases, ISO-8859-1 web pages, or some serial devices. In Latin-1, e9 is é on its own, whereas UTF-8 would report e9 as an invalid sequence. Every byte is valid Latin-1, so this option never fails.