Text ↔ Hex Converter
Encode text into hexadecimal and decode hex back into readable text — UTF-8 safe, entirely in your browser.
1,065 views
Text to Hex
Hex to Text
How Does Text-to-Hex Encoding Work?
Hexadecimal is a base-16 positional number system: 16 symbols (0-9, then A-F for 10-15) where each digit's position is worth a power of 16. The reason it pairs so naturally with computing is that one hex digit represents exactly 4 bits (one "nibble") — so two hex digits always represent exactly one byte (8 bits), with no rounding or ambiguity. That is why a byte value never needs more than two hex characters: 0-255 maps cleanly onto 00-FF.
This tool converts text to and from that representation. Text is first converted to raw bytes using UTF-8 (so every character, including Turkish letters and emoji, survives the round trip), then each byte is written as its two-digit hex pair: "Hi" becomes 48 69, because the letter H is byte 72 (0x48) and i is byte 105 (0x69). A concrete example with a non-ASCII character: "çay" encodes to C3 A7 61 79 — "ç" alone takes two bytes (C3 A7) because it falls outside the single-byte ASCII range, while "a" and "y" are one byte each. Decoding reverses the process, ignoring spaces, line breaks and "0x" prefixes.
This pairing between text, bytes and hex is also why the tool is useful well beyond curiosity: pasting a hex dump from a network sniffer or a serial console and reading it back as text, embedding a short binary payload inside a JSON string as hex, or double-checking that a value your own code produced matches what a spec document shows in hex — all of these are just the encode/decode direction applied to a real debugging task.
What to Know
- Hex encoding is not encryption: it only changes the representation of data, not its secrecy. Every hex string decodes instantly and deterministically back to the original bytes — anyone with the string can read it. For actual confidentiality use real encryption (e.g. AES), not encoding.
- Why 4 bits per digit matters: a nibble (4 bits) has exactly 16 possible values (0000-1111 in binary), which maps one-to-one onto a single hex digit with nothing left over — unlike decimal, where converting binary to base-10 requires arithmetic across the whole number. This is why hex shows up in color codes (#RRGGBB — three bytes, six hex digits), memory addresses, and low-level debugging: it is the most compact readable view of raw binary.
- UTF-8 is variable-width: ASCII characters take one byte, but accented letters and most non-Latin scripts take two, and emoji often take four — which is why the hex output length is not simply "two characters per visible letter" once non-ASCII text is involved.
- Accepted input formats: the decoder accepts hex pairs with or without spaces, line breaks, or "0x" prefixes — "48 69", "4869" and "0x48 0x69" all decode to "Hi".
- Case does not matter for decoding: hex letters A-F can be written upper or lower case (or mixed) and will decode identically, since both represent the same four-bit values — only the byte grouping and order matter.
Frequently Asked Questions
Is hex encoding secure?
No — it only changes the representation, not the secrecy. Anyone can decode hex instantly. For confidential data use real encryption (e.g. AES) instead.
Are Turkish characters and emoji supported?
Yes. The tool encodes via UTF-8, so every Unicode character — accents, Turkish letters, emoji — converts and restores correctly, even though some characters take up more than one byte.
What input formats does the decoder accept?
Plain hex pairs with or without spaces, line breaks or "0x" prefixes: "48 69", "4869" and "0x48 0x69" all decode to "Hi".
Why does one hex digit always equal 4 bits?
Because 4 bits can represent exactly 16 distinct values (2⁴ = 16), matching the 16 symbols of hexadecimal (0-9, A-F) one-to-one. That is why converting between binary and hex is pure lookup, with no division or remainder arithmetic needed, unlike converting to decimal.
Why do color codes like #FF5733 use hex instead of decimal?
A color's red, green and blue channels are each stored as a single byte (0-255), and hex represents a byte compactly as exactly two digits — #FF5733 reads instantly as three bytes, FF, 57 and 33, whereas the decimal equivalent (255, 87, 51) needs separating commas and variable-length numbers, which is clumsier to type into CSS or a design tool.
Similar Tools
Report a Problem
Text ↔ Hex Converter
Comments
No comments yet — be the first to write one!