String to Hex Converter
Convert any text string to its hexadecimal representation. Choose uppercase or lowercase hex, pick your separator, and copy or download the result.
Input String
Hex Output
What Is a String to Hex Converter?
Every character in your text has a numeric code point, and hexadecimal (base 16) is the most common way programmers write those codes. A String to Hex converter encodes your input as Unicode UTF-8 and writes each byte as a two-digit hex value. For example, "H" becomes 48 and "i" becomes 69, while "é" takes two bytes, C3 A9. This notation is everywhere in software: CSS color values, memory addresses in debuggers, HTTP header bytes, file magic numbers, and C-style escape sequences all use hex. When you need to inspect raw byte values, encode binary data for a protocol, or debug a network packet, being able to quickly see the hex equivalent of a string is invaluable. The hex is produced by this page as you type, so a password or token you are inspecting is not uploaded. You can choose uppercase (4A) or lowercase (4a), and separate values with a space, comma, newline, no separator, or the 0x prefix notation common in C, Python, and assembly. The underlying conversion uses the browser's TextEncoder to get the UTF-8 bytes and then toString(16) to render it as hex.
How to Use
Type or paste your string
Paste the string you want to inspect on the left, or Upload a .txt file. Spaces, tabs and line breaks get a code too (a newline shows up as 0A), which is often the invisible character you were hunting for.
Choose case and separator
Pick Uppercase or Lowercase hex output. Then select how values are separated: space, comma, newline, none, or the 0x prefix format. Every keystroke refreshes the hex.
Copy or download
"Copy" puts the hex digits on your clipboard; "Download" writes them into a .txt file.
Example
Here's a worked example. The string "Hi" has two characters: "H" and "i". In hex (uppercase, space-separated) they map to:
"Hi" → Hex (uppercase, space)
Hi→ Hex (uppercase, space-separated)
48 69FAQ
Why does "H" convert to 48 in hex?
"H" has the decimal ASCII code 72. Convert 72 to base 16: 72 ÷ 16 = 4 remainder 8 → 48. You can verify this on the ASCII table. Lowercase "h" is decimal 104, which is 68 in hex.
What is the difference between uppercase and lowercase hex?
It's purely cosmetic: 4A and 4a represent exactly the same value. Uppercase is common in hardware documentation, memory dumps, and protocols like HTTP. Lowercase is the default in many programming languages (JavaScript's toString(16), Python's hex(), etc.). Pick whichever your target system expects.
What does the 0x prefix mean?
The 0x prefix is a convention from the C programming language that signals "this number is written in hexadecimal." So instead of 48 69, you get 0x48 0x69. This format is used in C, C++, Python, JavaScript, and most other languages when writing hex literals in source code.
Does this work with non-ASCII characters like emoji or accented letters?
Yes. The text is turned into UTF-8 bytes first, and every byte gets its own hex value. ASCII stays one byte per character, "é" becomes C3 A9, "€" becomes E2 82 AC and 😀 becomes F0 9F 98 80, the same bytes you would see in a hex dump of a UTF-8 file.
Is my text sent to a server?
No. The conversion is a few lines of JavaScript on this page, with no backend, logging or data collection behind it, so whatever you type is never uploaded.
How do I reverse the conversion (hex back to text)?
This tool only converts text → hex. For the reverse, use a Hex to Text converter. In JavaScript you can reconstruct a string with String.fromCharCode(parseInt("48", 16)), or look for a dedicated "hex to string" tool.
What separator should I use?
It depends on your use case. Space-separated is the most readable. Comma-separated works well for CSV or array initializers. No separator gives a compact hex stream (like 486920576f726c64): common for binary file signatures and cryptographic hashes. The 0x prefix format pastes straight into a C/C++ or Python byte array.