HEXADECIMAL ENCODING GUIDE
Text to Hex Converter – Convert Text to Hexadecimal and Hex to Text Online Free
A text to hex converter turns every character you type into its hexadecimal byte values, so the word Hello becomes 48 65 6C 6C 6F, and a hex to text decoder does exactly the opposite, turning those numbers back into readable words. Our free online text to hex converter does both directions in your browser, in real time, with no signup, no installation and no limit on how much you convert. Unlike basic tools that only understand English letters, this string to hex converter supports full Unicode through UTF-8 and UTF-16, which means accented letters, Arabic and Urdu script, Chinese characters, symbols and even emoji are converted correctly and can be decoded back without losing a single character. You can also choose how the hex is written, with spaces, without spaces, separated by commas, with the 0x prefix used in C and JavaScript arrays, or with the backslash-x escape style used in strings, and you can switch between uppercase and lowercase letters. Developers use text to hex conversion for debugging network traffic, building byte arrays, inspecting database values and studying file formats, while students, security enthusiasts and puzzle solvers use it to learn how computers store text. A built-in character breakdown table shows the Unicode code point, decimal value and exact hex bytes of every character, so you can see precisely how the conversion works instead of just trusting the output.
Use this free text to hex converter as a hex encoder, a hex to string decoder, a hex dump viewer for short strings and a quick way to prepare byte values for code. It supports UTF-8, UTF-16 and ASCII, so English, Urdu, Arabic, Hindi and emoji all convert correctly, and you can choose spaced hex, continuous hex, comma separated hex, 0x prefixes or \x escapes. It works on Windows, Mac, Linux, Android and iPhone, runs in your browser and never uploads your text.
T→H
Text to Hex Converter with UTF-8 Support
Convert any string to hexadecimal using UTF-8, the encoding used by almost every website and modern system. Plain English letters become one byte each, while accented letters, Urdu and Arabic script and emoji become two, three or four bytes, exactly as they are stored on disk and sent over the network.
H→T
Hex to Text Decoder and Hex to String Converter
Paste a hex string in any common format and get the original text back. The decoder understands spaces, commas, new lines, 0x prefixes and backslash-x escapes, validates the input and tells you clearly when a digit is invalid or the number of digits is odd.
0x
Hex Output for Code: 0x, \x and Comma Formats
Choose the output style that matches your code. Get 0x48, 0x65 style lists for byte arrays, \x48\x65 escapes for strings, comma-separated values for CSV and spreadsheets, or a compact unbroken hex string for hashes, keys and database functions.
How to Use the Text to Hex Converter (Step by Step)
Converting text to hexadecimal takes only a few seconds, and the result updates as you type. Follow these steps to convert text to hex or decode hex back into text.
-
Select the direction: Choose Text → Hex to encode text, or Hex → Text to decode a hex string back into readable characters.
-
Enter your input: Type or paste text into the first box. In Hex → Text mode, paste your hex values in any format, with or without spaces, commas, 0x or backslash-x prefixes.
-
Pick the encoding: Keep UTF-8 for almost everything, choose UTF-16 when you work with Windows, Java or JavaScript internals, or choose ASCII for plain 7-bit English text.
-
Choose the hex style and case: Select spaces, no separator, commas, 0x prefix or backslash-x, and decide between uppercase and lowercase letters.
-
Copy, download or swap: Copy the output to your clipboard, download it as a text file, or press Swap to send the output back into the input and convert in the opposite direction.
Need the same text in another number system? Try text to binary, text to ASCII or text to Unicode.
Everything is processed on your device, so you can safely paste private strings, configuration values or test data without them ever leaving your browser.
What Is Hexadecimal and Why Convert Text to Hex?
Hexadecimal, or hex, is a base-16 number system. Instead of the ten digits of the decimal system, hex uses sixteen symbols: the digits 0 to 9 and the letters A to F, where A means 10, B means 11 and F means 15. Computers store everything as bits, and eight bits make one byte. A single byte can hold a value from 0 to 255, and in hexadecimal that range is written with exactly two digits, from 00 to FF. This tidy fit is the reason hex is so popular: one byte is always two hex digits, which makes long binary data far shorter and easier to read than a string of ones and zeros, while still mapping perfectly onto the underlying bits.
Text is stored as numbers too. Every character has a numeric code, and an encoding such as ASCII or UTF-8 defines how that code becomes one or more bytes. Converting text to hex simply shows those bytes in base 16. People do this to see the real data behind a string, to find invisible characters, to compare values exactly, to write byte arrays in source code, to send binary-safe text through systems that only accept printable characters and to understand how encodings actually work.
How Text to Hex Conversion Works: A Manual Example
The conversion has three small steps. First, each character is looked up in a character set to find its code number. Second, that number is turned into bytes by the chosen encoding. Third, each byte is written as two hexadecimal digits. For ordinary English letters in ASCII or UTF-8 the process is very direct, because the character code is the byte. The table below walks through the word Hello one letter at a time.
Converting the word "Hello" to hexadecimal step by step
| Character |
Decimal code |
Binary (8 bits) |
Hex |
| H |
72 |
01001000 |
48 |
| e |
101 |
01100101 |
65 |
| l |
108 |
01101100 |
6C |
| l |
108 |
01101100 |
6C |
| o |
111 |
01101111 |
6F |
Put together, Hello becomes 48 65 6C 6C 6F. To convert a decimal code by hand, divide it by 16: the quotient is the first hex digit and the remainder is the second. For 72, the quotient is 4 and the remainder is 8, so the hex value is 48. Reading hex back to text works the same way in reverse, which is exactly what the Hex → Text mode does for you.
ASCII to Hex Table: Common Characters and Their Hex Values
ASCII is the original character set of computing and covers 128 characters: English letters, digits, punctuation and control codes. It is the foundation of UTF-8, because the first 128 UTF-8 values are identical to ASCII. Knowing a few common values makes hex dumps much easier to read at a glance. Capital letters start at 41, lowercase letters start at 61, and the digits start at 30.
Common ASCII characters and their hexadecimal values
| Character |
Hex |
Decimal |
Description |
| 0 – 9 |
30 – 39 |
48 – 57 |
Digits |
| A – Z |
41 – 5A |
65 – 90 |
Uppercase letters |
| a – z |
61 – 7A |
97 – 122 |
Lowercase letters |
| Space |
20 |
32 |
Word separator |
| Tab |
09 |
9 |
Horizontal tab |
| Line feed |
0A |
10 |
New line (Linux, macOS) |
| Carriage return |
0D |
13 |
Used with 0A for Windows new lines |
A handy pattern: the uppercase and lowercase version of the same English letter differ by exactly 20 in hex. A is 41 and a is 61, B is 42 and b is 62, and so on. That is one more reason hex is useful for spotting what is really inside a string.
UTF-8, Unicode and Emoji: How Non-English Text Becomes Hex
ASCII cannot represent Urdu, Arabic, Chinese, Hindi, Cyrillic or emoji, which is why Unicode and UTF-8 exist. Unicode assigns a unique number, called a code point, to every character in every writing system. UTF-8 then stores each code point in one to four bytes, using fewer bytes for common characters and more for rare ones. English letters take one byte, most Latin accents and many alphabets take two, most Asian scripts and symbols take three, and emoji take four. Because of this variable length, the hex of a non-English word is always longer than the number of visible characters, which is perfectly normal. The table below shows how the UTF-8 byte structure works, followed by a few real examples you can try in the converter.
UTF-8 byte structure by Unicode range
| Unicode range |
Bytes |
Byte pattern |
Typical characters |
| U+0000 – U+007F |
1 |
0xxxxxxx |
English letters, digits, punctuation |
| U+0080 – U+07FF |
2 |
110xxxxx 10xxxxxx |
Accented Latin, Arabic, Urdu, Hebrew, Cyrillic |
| U+0800 – U+FFFF |
3 |
1110xxxx 10xxxxxx 10xxxxxx |
Chinese, Japanese, Korean, currency symbols |
| U+10000 – U+10FFFF |
4 |
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
Emoji and rare historic scripts |
Examples of text converted to UTF-8 hex
| Character |
Code point |
UTF-8 hex |
Bytes |
| A |
U+0041 |
41 |
1 |
| é |
U+00E9 |
C3 A9 |
2 |
| ا (Arabic and Urdu alef) |
U+0627 |
D8 A7 |
2 |
| € |
U+20AC |
E2 82 AC |
3 |
| 😀 |
U+1F600 |
F0 9F 98 80 |
4 |
Choose UTF-16 only when you specifically need it, for example when matching how Windows, Java or JavaScript store strings in memory. UTF-16 uses two bytes for most characters and four bytes for characters outside the Basic Multilingual Plane, such as emoji, and the byte order, big-endian or little-endian, changes the order of each byte pair.
Hex Output Formats Explained: Spaces, 0x, \x and Commas
Hex data is written in several different ways depending on where it will be used. Instead of editing the output by hand, pick the style that fits your destination and copy it directly. The table below explains each format, what it looks like for the word Hi, and where it is typically used.
Hex output styles and their typical uses
| Style |
Result for "Hi" |
Typical use |
| Space separated |
48 69 |
Easy reading, hex dumps, documentation |
| No separator |
4869 |
Hashes, keys, database functions, URLs |
| Comma separated |
48, 69 |
CSV files, spreadsheets, simple lists |
| 0x prefix |
0x48, 0x69 |
C, C++, Arduino, JavaScript and Python byte arrays |
| \x escape |
\x48\x69 |
String literals, payload strings, shell scripts |
Uppercase hex such as 4A is the traditional style in documentation and hex editors, while lowercase hex such as 4a is common in programming languages, hashes and web tools. Both mean exactly the same thing, so choose whichever matches your project.
Hex vs Binary vs Decimal vs Base64: Which Encoding Should You Use?
Hex is only one of several ways to write the same bytes. Binary is the most literal but very long, decimal is familiar but does not line up with bytes, and Base64 is the most compact for transferring data. Hex sits in the middle: it is easy to read, easy to convert by eye and perfectly aligned with bytes. The table below compares the four using the letter H, whose ASCII value is 72.
Comparison of common ways to represent text data
| System |
Base |
"H" looks like |
Size compared to original |
Best for |
| Hexadecimal |
16 |
48 |
2 characters per byte |
Debugging, hex dumps, hashes, byte arrays |
| Binary |
2 |
01001000 |
8 characters per byte |
Learning, bit-level work |
| Decimal |
10 |
72 |
1 to 3 characters per byte |
Character codes, human-friendly numbers |
| Base64 |
64 |
SA== |
About 4 characters per 3 bytes |
Email attachments, data URLs, APIs |
How to Convert Text to Hex in Python, PHP, JavaScript, MySQL and Linux
Once you understand what the converter does, you can reproduce the same result directly in your own code. The table below lists the quickest one-line methods in the most common environments. All of them use UTF-8 by default, so they match the output of this tool when UTF-8 is selected and the style is set to no separator in lowercase.
Text to hex and hex to text in popular languages and tools
| Environment |
Text to hex |
Hex to text |
| Python |
"Hello".encode().hex() |
bytes.fromhex("48656c6c6f").decode() |
| PHP |
bin2hex("Hello") |
hex2bin("48656c6c6f") |
| JavaScript (Node.js) |
Buffer.from("Hello").toString("hex") |
Buffer.from("48656c6c6f", "hex").toString() |
| MySQL |
SELECT HEX('Hello'); |
SELECT UNHEX('48656C6C6F'); |
| Linux terminal |
echo -n "Hello" | xxd -p |
echo 48656c6c6f | xxd -r -p |
For one-off conversions, testing and learning, an online text to hex converter is faster than opening a terminal or writing a script, and the character breakdown table makes it easy to double-check what each byte means.
Common Uses of Text to Hex Conversion
Hex is everywhere in software and hardware work, and converting text to hex solves many practical problems. Below are some of the most common situations where people reach for a hex converter.
- Debugging and finding hidden characters: A string that looks identical on screen may contain a non-breaking space, a zero-width character or a different line ending. Viewing the hex immediately exposes the difference.
- Network and protocol analysis: Packet captures, serial communication logs and API payloads are usually displayed in hex, so converting text helps you match readable messages with raw bytes.
- Programming and embedded systems: Byte arrays for C, C++, Arduino and microcontroller code are written with 0x prefixes, and text-to-hex output can be pasted straight in.
- Databases and SQL: Functions such as HEX and UNHEX, and binary column literals, use hexadecimal strings to store and compare exact byte values.
- Security, hashing and forensics: Hashes, keys and signatures are shown as hex strings, and analysts inspect text and file contents byte by byte.
- Learning and puzzles: Students, capture-the-flag players and puzzle makers use hex to understand encodings and to encode or decode hidden messages.
- Safe text transport: Hex turns any text, including special characters and line breaks, into plain 0 to 9 and A to F characters that survive systems that only accept simple text.
One important note: hex is an encoding, not encryption. Anyone can convert it back to the original text in a second, so never rely on it to hide passwords or secrets.
Hex to Text Not Working? Common Problems and Fixes
Decoding hex is simple when the input is clean, but a few typical issues can cause errors or strange output. This checklist covers the most frequent ones, so you can fix them quickly.
- Odd number of digits: Every byte needs two hex digits. If one digit is missing, add a leading zero, for example write 5 as 05.
- Invalid characters: Hex only uses 0 to 9 and A to F. Letters such as G, Z or O, and the digit zero confused with the letter O, will cause an error.
- Garbled output or question marks: This usually means the wrong encoding. If the hex came from UTF-8 text, decode it with UTF-8, not ASCII or UTF-16.
- Strange characters in the middle: The data may contain binary bytes that are not text, such as image or file data, which cannot be displayed as readable characters.
- Prefixes and separators: This tool removes 0x, backslash-x, spaces, commas, colons, dashes and new lines automatically, so you do not need to clean the hex first.
- UTF-16 byte order: If decoded text looks like unrelated characters, try the other UTF-16 option, because big-endian and little-endian reverse each byte pair.
Hexadecimal Digits Explained: 0 to F
Hexadecimal, or hex, is a base 16 number system. It uses the digits 0 to 9 and the letters A to F, where A is 10, B is 11 and F is 15. Because one hex digit stands for four bits, two hex digits describe exactly one byte, which is why hex is so popular for bytes and memory.
Hexadecimal digits with decimal and binary values
| Hex |
Decimal |
Binary |
| 0 |
0 |
0000 |
| 1 |
1 |
0001 |
| 2 |
2 |
0010 |
| 3 |
3 |
0011 |
| 4 |
4 |
0100 |
| 5 |
5 |
0101 |
| 6 |
6 |
0110 |
| 7 |
7 |
0111 |
| 8 |
8 |
1000 |
| 9 |
9 |
1001 |
| A |
10 |
1010 |
| B |
11 |
1011 |
| C |
12 |
1100 |
| D |
13 |
1101 |
| E |
14 |
1110 |
| F |
15 |
1111 |
Text to Hex Examples: Words and Phrases
These examples use UTF-8 encoding with spaced uppercase hex. Paste any of them into the converter to check the result.
Text to hex examples
| Text |
Hex (UTF-8) |
| Hi |
48 69 |
| Hello |
48 65 6C 6C 6F |
| Hello World |
48 65 6C 6C 6F 20 57 6F 72 6C 64 |
| tolioo |
74 6F 6C 69 6F 6F |
| Café |
43 61 66 C3 A9 |
| 😀 |
F0 9F 98 80 |
Hex in Everyday Computing: Colors, URLs, MAC Addresses and Hashes
Hex appears in many places beyond text conversion. Knowing where it shows up makes the converter more useful.
- Web colors: A color such as #FF5733 is three hex bytes for red, green and blue.
- URL encoding: A space in a web address becomes %20, where 20 is the hex value of the space character.
- MAC addresses: A network card address is written as six hex bytes, for example 00:1A:2B:3C:4D:5E.
- Hashes and checksums: MD5, SHA-1 and SHA-256 results are normally shown as long hex strings.
- Hex editors and memory dumps: Files and memory are displayed as hex so every byte is visible.
- Character escapes: Many languages accept \x41 or 0x41 for the letter A.
Convert Hex to Text Step by Step
- Switch the converter to Hex to Text.
- Pick the same encoding that was used to create the hex. UTF-8 is correct for almost all modern text.
- Paste your hex. Spaces, commas, 0x prefixes and \x prefixes are understood, and continuous hex is grouped automatically.
- Read the decoded text. If the length is odd or a character is invalid, the tool tells you so you can fix it.
- Use the swap button to send the result back to the input for a round-trip check.
Hex Encoding vs Base64 vs Binary: Size Comparison
Hex is simple and readable, but it is not the most compact way to write bytes. The table shows how much space each representation needs for the same data.
Size of the same data in different encodings
| Format |
Characters per byte |
Best for |
| Binary |
8 |
Learning and bit-level work |
| Hexadecimal |
2 |
Debugging, bytes, hashes and code |
| Base64 |
About 1.33 |
Sending binary data inside text, such as email or JSON |
Is Hex Encoding the Same as Encryption?
No. Hex is a way to write bytes, not a way to protect them. Anyone can turn hex back into text in a second with a tool like this one, so never use hex to hide passwords or private information. Use proper encryption for security.
Hex Converter Tips for Developers and Students
- Use the 0x or \x style when you want to paste values straight into source code.
- Pick lowercase hex for URLs and many APIs, and uppercase hex for documentation and datasheets.
- Use the character breakdown table to see how many bytes each character takes, especially for emoji and non-English text.
- Compare UTF-8 and UTF-16 output when you debug text from different systems.
- Check that both sides of a system use the same encoding before you blame the data.
Is My Text Private When I Convert It to Hex?
Yes. Everything runs in your browser. Your text and hex values are not uploaded, saved or stored on a server, and they disappear when you close or refresh the page.
More Free Text Tools You May Need
Hex is one of several useful ways to look at text as numbers. These related free tools can help:
Free Online Text to Hex Converter for Any Device
This online hex converter works in any modern web browser on Windows, Mac, Linux, Android and iPhone, with no app, plugin or account. There is no watermark, no daily limit and no waiting for a server, because the conversion happens instantly on your own device, which also means your text is never uploaded. Whether you want to convert a string to hexadecimal for a coding project, decode a hex string you found in a log file, generate a byte array for a microcontroller, or simply explore how emoji and Urdu text look as bytes, you can get an accurate result and a full character breakdown in a moment.
Ready to try it? Scroll back up, paste your text and watch the hex appear instantly. If you work with other text and developer tasks, explore the rest of the free tools on our site.