String to Hex Converter
Convert any text string to its hexadecimal representation instantly. 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 takes each character in your input and outputs its Unicode code point as a two-digit (or longer) hex value. For example, "H" becomes 48 and "i" becomes 69. 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. This tool runs entirely in your browser — your text never leaves your device. 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 JavaScript's charCodeAt() to get each character's UTF-16 code unit and then toString(16) to render it as hex.
How to Use
Type or paste your string
Drop any text into the left panel. Every character — including spaces, punctuation, and newlines — gets converted. You can also click "Upload" to load a plain text file.
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. The output updates in real time as you type.
Copy or download
Hit "Copy" to send the hex output to your clipboard, or "Download" to save it as 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 tool uses JavaScript's charCodeAt(), which returns the UTF-16 code unit for each character. For basic Latin and most European scripts, code points are the same as Unicode code points. For emoji and characters above U+FFFF, JavaScript represents them as two surrogate pairs, so you'll see two hex values per emoji.
Is my text sent to a server?
No. Everything runs locally in your browser using JavaScript. Your text never leaves your device — there is no backend, no logging, and no data collection.
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 is ideal for pasting directly into C/C++ or Python source code.