How to Convert Text to Hexadecimal

Converting text to hex involves encoding characters into bytes, then representing those bytes in base-16 notation. Start by selecting your character encoding from the dropdown:

  • UTF-8 (recommended): Industry standard, handles all Unicode characters including emojis and non-Latin scripts with variable-length byte sequences.
  • UTF-16: Fixed 2-byte characters with a byte-order mark (BOM) prefix; useful for systems expecting explicit endianness.
  • UTF-16 LE/BE: Little-endian or big-endian without BOM; common in low-level applications.
  • Windows-1252: Legacy single-byte encoding for Western European text.

Next, configure your separator—spaces, colons, or hyphens between byte pairs improve readability. Paste your text and the converter outputs each character's hex equivalent.

Text-to-Hex Conversion Process

The conversion follows a three-step pipeline:

1. Encode character → UTF-8 bytes (variable length)

2. Convert each byte value to base-16 (0–255 → 00–FF)

3. Join bytes with chosen separator

  • Character — Any single symbol (letter, digit, punctuation, emoji)
  • Byte value — Numeric representation of the character in your chosen encoding (0–255 for single-byte, multiple for multi-byte)
  • Hex pair — Two-digit hexadecimal notation (00–FF) of each byte

Hex Values for Common Characters

Uppercase and lowercase ASCII letters map to consistent hex ranges. Case matters—'A' and 'a' produce different outputs:

  • A–Z: 41–5A
  • a–z: 61–7A
  • 0–9: 30–39
  • Space: 20
  • Exclamation (!): 21
  • Period (.): 2E

Non-ASCII characters like é, ñ, or 中 require multi-byte sequences in UTF-8. For example, 'ñ' becomes C3 B1 (two bytes) rather than a single pair. Use the converter to explore how your text encodes across different character sets.

Understanding Hexadecimal and Encoding

Hexadecimal is a base-16 numeral system using digits 0–9 and letters A–F (A=10, B=11, up to F=15). This compact representation is preferred in computing because one hex digit describes half a byte (a nibble), and two hex digits represent one full byte—the atomic unit of digital storage.

Character encodings define how software maps abstract characters to numeric byte sequences. UTF-8 revolutionized text handling by using variable-length encoding: ASCII remains 1 byte, but accented characters, Greek, Arabic, CJK, and emoji require 2–4 bytes. Older encodings like Windows-1252 are single-byte and can't represent characters outside their defined range, making them unsuitable for international content.

Practical Considerations

Avoid common pitfalls when converting text to hexadecimal.

  1. Encoding choice affects output length — UTF-8 expands non-ASCII text (emoji can be 4 bytes), while Windows-1252 fails entirely on characters outside its range. Always verify your encoding matches your use case—web standards mandate UTF-8.
  2. Separator selection impacts readability — Spaces (48 65 6C 6C 6F) are human-friendly; colons (48:65:6C:6C:6F) or no separator (48656c6c6f) are common in programming and data formats. Choose based on where you'll paste the result.
  3. Case sensitivity in output — Hex pairs use uppercase A–F by convention but some systems prefer lowercase. Most tools accept both, but verify before inserting into code or protocols.
  4. Whitespace and control characters matter — Spaces, tabs, and newlines have hex values (20, 09, 0A respectively). Accidental trailing spaces in your input will appear in the hex output, potentially breaking string comparisons or network protocols.

Frequently Asked Questions

What's the step-by-step process for manual text-to-hex conversion?

First, choose your encoding—UTF-8 is safest for modern applications. Second, represent each character as bytes according to that encoding: the letter 'A' becomes byte 65, while 'ñ' becomes bytes 195 and 177 in UTF-8. Third, convert each byte to hexadecimal: 65 becomes 41, and the pair 195, 177 becomes C3, B1. Finally, concatenate or separate the hex pairs as desired. This manual approach helps you understand how text becomes data.

Why does the word 'Hello' convert to 48 65 6C 6C 6F in hex?

Each letter encodes to a specific byte in UTF-8 (which matches ASCII for English): H=72 decimal (48 hex), e=101 decimal (65 hex), l=108 decimal (6C hex), l=108 decimal (6C hex), o=111 decimal (6F hex). When written with spaces as separators, you get 48 65 6C 6C 6F. Different encodings—UTF-16 or Windows-1252—would produce different sequences, but UTF-8 is the universal standard.

Can you convert emojis and non-Latin characters to hex?

Yes, provided you select an encoding that supports them. UTF-8 and UTF-16 handle all Unicode characters, including emojis, CJK (Chinese, Japanese, Korean), Cyrillic, and Arabic. A single emoji typically requires 3–4 bytes in UTF-8, resulting in longer hex strings than ASCII. Legacy encodings like Windows-1252 will fail on such characters, so always choose UTF-8 for international or emoji-rich text.

What is hexadecimal and why is it used for text conversion?

Hexadecimal (base-16) uses digits 0–9 and letters A–F to represent numbers compactly. Since computers store text as bytes (0–255), hex elegantly displays each byte as exactly two characters: 00–FF. This compression makes hex ideal for logs, network packets, cryptographic hashes, and debugging. One hex digit encodes 4 bits (a nibble), making pairs of hex digits perfectly aligned with byte boundaries.

How does UTF-8 differ from other text encodings?

UTF-8 uses variable-length encoding: ASCII characters remain 1 byte, while accented and non-Latin characters consume 2–4 bytes depending on Unicode range. This makes UTF-8 backward-compatible with ASCII and space-efficient for English-heavy text. UTF-16 always uses 2 bytes (or 4 for rare characters), consuming more space but simplifying some internal processing. Windows-1252 is fixed single-byte but limited to ~256 characters. UTF-8 dominates the modern web because it balances efficiency and universal coverage.

Why is case sensitivity important in hex conversion?

Hex uses digits 0–9 and letters A–F; 'a' and 'A' represent the same value (10), but in your output text they may differ stylistically. More critically, the input text is case-sensitive: the character 'A' and 'a' encode to different byte values (41 vs. 61 in hex). If you convert 'Hello' versus 'hello', the hex strings will differ. Always preserve the original case of your source text when converting.

More other calculators (see all)