Text to Hex
Convert text into hexadecimal. Each character becomes its hex character code, separated by spaces, updating live as you type.
0 characters
0 characters
About Text to Hex
This tool provides a direct conversion from a string of text characters into their corresponding hexadecimal values based on a selected character encoding. At its core, text on a computer is not stored as letters or symbols, but as a sequence of numbers. This process, known as character encoding[4], maps each character to a unique numeric value. The hexadecimal[8] (base-16) numeral system is a human-friendly way to represent the underlying binary[2] data, as one hexadecimal digit corresponds precisely to four binary digits (a nibble), making it more compact and readable than raw binary for tasks like debugging, data analysis, and creating a hex dump[7].
The foundational standard for character encoding in the English-speaking world was ASCII[1] (American Standard Code for Information Interchange), which uses 7 bits to represent 128 characters, including control codes, numbers, and the English alphabet. Its primary limitation was its inability to represent characters from other languages. To solve this, the Unicode[10] standard was developed. Unicode is a universal character set that assigns a unique number, called a code point[5], to every character in virtually every writing system, as well as symbols and emojis. This tool allows you to see how those abstract code points are translated into concrete byte sequences.
Unicode itself is a character set, not an encoding. The mapping of its code points to actual byte values is handled by a Unicode Transformation Format (UTF). The most common encoding on the web is UTF-8[11], a variable-width encoding defined in RFC 3629[14]. It uses one byte for ASCII characters, making it backward compatible, and up to four bytes for other characters. This efficiency is a key trade-off. In contrast, UTF-16[12] uses one or two 16-bit code units, and UTF-32[13] uses a single 32-bit code unit for every character, offering simplicity at the cost of larger file sizes, especially for text dominated by ASCII characters.
When working with multi-byte encodings like UTF-16 and UTF-32, the concept of endianness[6] becomes critical. This refers to the order of bytes within a multi-byte word: big-endian (most significant byte first) or little-endian (least significant byte first). To resolve ambiguity, a special Byte Order Mark[3] (BOM) character (code point U+FEFF) may be prepended to the text stream. This tool allows you to specify the encoding and endianness to observe these differences directly, providing a clear view into the fundamental data structures that enable modern digital communication and information exchange, as governed by standards from bodies like the Unicode Consortium[16].
How to Use
- Paste or type your text into the designated input area.
- Select the desired character encoding from the dropdown menu (e.g., UTF-8, UTF-16BE).
- The tool will automatically convert the text and display the hexadecimal output.
- Optionally, choose a delimiter (like a space or comma) to separate the hex values for readability.
- Use the copy button to transfer the resulting hexadecimal string to your clipboard.
Frequently Asked Questions
What is hexadecimal and why is it used for text?
Hexadecimal is a base-16 numeral system using digits 0 to 9 and letters A to F. It is used as a compact, human-readable representation of binary data. Since a single byte (8 bits) can be represented by exactly two hexadecimal digits (e.g., 10110101 in binary is B5 in hex), it is a convenient way to view the raw byte values that make up a text file according to its character encoding[4].
What is the difference between a character set and a character encoding?
A character set, like Unicode[10], is a collection of characters mapped to unique numbers called code points[5]. A character encoding, like UTF-8[11], is a specific algorithm that translates these code points into a sequence of bytes for storage or transmission. One character set can have multiple encodings.
Why does the character 'β¬' have different hex values in UTF-8 and UTF-16?
The Euro sign 'β¬' is Unicode code point U+20AC. In UTF-8[11], this code point is encoded as the three-byte sequence `E2 82 AC`. In UTF-16[12] (big-endian), it is encoded as the two-byte sequence `20 AC`. The encoding scheme dictates the byte representation, so the same character results in different hex values.
What is a Byte Order Mark (BOM)?
A Byte Order Mark[3] (BOM) is the Unicode character U+FEFF placed at the beginning of a text stream. Its purpose is to signal the endianness[6] (byte order) of the text. For example, in a UTF-16 big-endian file, the BOM appears as `FE FF`. In a little-endian file, it appears as `FF FE`. While optional in UTF-8 (where it appears as `EF BB BF`), it is not recommended as UTF-8 has no byte order issues.
How are emojis represented in hexadecimal?
Emojis are characters within the Unicode[10] standard. For example, the 'Grinning Face' emoji π is assigned code point U+1F600. When encoded using UTF-8[11], this single code point is represented by the four-byte hexadecimal sequence `F0 9F 98 80`. This tool shows you that exact byte sequence.
Is this the same as Percent Encoding used in URLs?
No, though they both use hexadecimal. Percent-encoding[9] (or URL encoding), defined in RFC 3986[15], is used to encode data in a URL. It represents unsafe characters by a '%' sign followed by two hex digits corresponding to the character's UTF-8 byte value (e.g., a space becomes '%20'). This tool provides the raw hex values (`20`), not the percent-encoded string.
What is the difference between ASCII and UTF-8?
ASCII[1] is a 7-bit encoding for 128 characters, primarily for English. UTF-8[11] is a variable-length encoding for the entire Unicode character set. A key feature of UTF-8 is that the first 128 characters are encoded using a single byte, identical to their ASCII representation. This makes UTF-8 backward compatible with ASCII.
Sources (16)
- Wikipedia: ASCII
- Wikipedia: Binary number
- Wikipedia: Byte order mark
- Wikipedia: Character encoding
- Wikipedia: Code point
- Wikipedia: Endianness
- Wikipedia: Hex dump
- Wikipedia: Hexadecimal
- Wikipedia: Percent-encoding
- Wikipedia: Unicode
- Wikipedia: UTF-8
- Wikipedia: UTF-16
- Wikipedia: UTF-32
- IETF RFC 3629: UTF-8, a transformation format of ISO 10646
- IETF RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
- The Unicode Consortium: The Unicode Standard
About Matt George
I'm Matt George, a software engineer in the startup space. I run my own shop building software for early-stage founders, and I love making free tools and experiences that people actually use. Enjoy using Text to Hex!