Text to Hex Converter
This text to hex converter turns any text or string into hexadecimal and decodes hex back into text. Output comes spaced (48 65 6C), run together (48656c), as a 0x array, as \x escapes, URL %-encoded or colon-separated, in upper or lower case, and hex in any of those forms can be pasted back to decode. Text is encoded as UTF-8, so accents, Chinese and emoji convert correctly, and each character is listed with its hex bytes, code point and binary, alongside a classic hex dump.
How it works
Type or paste text to see its bytes in hexadecimal: each byte is two hex digits, so Hello becomes 48 65 6C 6C 6F. Text is encoded as UTF-8 first, so every alphabet works — é is two bytes (C3 A9) and an emoji is four.
Switch to Hex → Text to decode. Hex can be pasted in any common form: 48 65 6C, 48656c, 0x48, 0x65, \x48\x65, %48%65 or 48:65.
How to convert text to hex by hand
Every character has a number. For English letters, digits and punctuation that number is its ASCII code, and the hex is that number written in base 16: divide by 16, and the quotient and remainder are the two hex digits (10 to 15 are written A to F). For Hello:
| Character | ASCII code | ÷ 16 | Hex |
|---|---|---|---|
| H | 72 | 4 remainder 8 | 48 |
| e | 101 | 6 remainder 5 | 65 |
| l | 108 | 6 remainder 12 (C) | 6C |
| l | 108 | 6 remainder 12 (C) | 6C |
| o | 111 | 6 remainder 15 (F) | 6F |
So Hello in hex is 48 65 6C 6C 6F, or 48656c6c6f without spaces.
ASCII to hex table
The printable ASCII characters. Read the first hex digit from the row and the second from the column: A
is row 4, column 1, so 41. Capitals and lowercase letters are exactly 20 apart
(A = 41, a = 61), and the digits 0–9 are 30–39.
| First digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2_ | SP | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
3_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
4_ | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
5_ | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
6_ | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
7_ | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL |
SP is the space (20). Below 20 are control characters: 09 is a tab,
0A a line feed and 0D a carriage return.
Accents, other alphabets and emoji
ASCII stops at 7F. Every other character is stored in UTF-8 as two to four bytes, which is why text with
accents or emoji produces more hex than it has characters:
| Character | Code point | UTF-8 hex | Bytes |
|---|---|---|---|
| A | U+0041 | 41 | 1 |
| é | U+00E9 | C3 A9 | 2 |
| € | U+20AC | E2 82 AC | 3 |
| 你 | U+4F60 | E4 BD A0 | 3 |
| 😀 | U+1F600 | F0 9F 98 80 | 4 |
If you need the Unicode number rather than the stored bytes, for example to write é in source
code, choose Unicode code points in the converter.
How to convert hex to text
Split the hex into pairs, turn each pair into a byte, and read the bytes as UTF-8: 48 69 21 is
Hi!. Hex with no spaces works the same way, two digits at a time. That is why the number of digits must be
even; an odd count means one went missing when the hex was copied, and every byte after it would be read wrongly.
If the result shows � characters, those bytes are not valid UTF-8. The usual causes are bytes in the wrong order (for numbers stored little-endian, try the reverse hex tool), a sequence cut short, or text saved in an older encoding such as Latin-1.
Hex formats and where they are used
| Format | Example | Where you see it |
|---|---|---|
| Spaced | 48 65 6C 6C 6F | Hex dumps, debuggers, network captures |
| No spaces | 48656c6c6f | Hashes, keys, database columns, most programming output |
| 0x array | 0x48, 0x65, 0x6C | Byte arrays in C, C++, Java and C# |
| \x escapes | \x48\x65\x6C | String literals in Python, C, JavaScript and shell printf |
| %-encoded | %48%65%6C | URLs and form data |
| Colon-separated | 48:65:6C | MAC addresses and certificate fingerprints |
The same conversion in code, for reference:
- Python:
'Hello'.encode().hex()gives'48656c6c6f', andbytes.fromhex('48656c6c6f').decode()reverses it. - JavaScript:
[...new TextEncoder().encode('Hello')].map(b => b.toString(16).padStart(2, '0')).join(''). - Command line:
printf 'Hello' | xxd -pprints48656c6c6f.
Reading a hex dump
The dump below the converter shows the bytes the way most tools do: an offset, sixteen bytes in hex, and the same bytes as text. A few values are worth recognising on sight:
20— a space. Long runs of them mean padding.0Aand0D— line feed and carriage return. A0D 0Apair means Windows line endings.EF BB BF— a UTF-8 byte order mark at the start of a file.C3followed by something — the first byte of a two-byte UTF-8 sequence, so an accented letter.00— a null. In a text file, usually a sign the data is UTF-16 or not text at all.
To write the bytes in binary instead, use text to binary; to convert a single number between hex, decimal and binary, use the number base converter.
Frequently asked questions
How do I convert text to hex?
Each character is stored as one or more bytes, and each byte is written as two hexadecimal digits. Type or paste your text and the hex appears as you type: Hello becomes 48 65 6C 6C 6F. Choose the output format — spaced, no spaces, 0x array, \x escapes, %-encoded or colon-separated — and upper or lower case.
How do I convert hex back to text?
Switch to Hex → Text and paste the hex. It can be in almost any form: 48 65 6C, 48656c, 0x48, 0x65, \x48\x65, %48%65 or 48:65 all decode, and the prefixes, quotes, brackets and separators are stripped for you.
How do you convert a letter to hex by hand?
Look up the character code and write it in base 16. H is 72 in ASCII; 72 ÷ 16 = 4 remainder 8, so H is 48 in hex. Lowercase letters are 20 higher than capitals: A is 41 and a is 61. The page has an ASCII hex table for the common characters.
Is text to hex the same as ASCII to hex?
For plain English letters, digits and punctuation, yes: ASCII and UTF-8 give the same single byte for each. They differ only beyond ASCII, where UTF-8 uses two to four bytes — é is C3 A9, € is E2 82 AC and 😀 is F0 9F 98 80. ASCII has no codes for those characters at all.
Why hexadecimal rather than decimal?
Every byte is exactly two hex characters, so a dump stays aligned and each character maps to exactly four bits. Decimal bytes vary between one and three digits and align badly.
What is the difference between UTF-8 bytes and code points?
A code point is a character’s number in Unicode, such as U+00E9 for é. UTF-8 bytes are how that number is stored: é becomes the two bytes C3 A9. Most systems want the bytes; choose code points when you need the U+ number, for example to write \u00E9 in code.
What does it mean when some characters show as �?
The bytes are not valid UTF-8 at that point, so the readable part is decoded and each broken sequence is marked with �. Usually the bytes are in the wrong order, some are missing, the text was saved in another encoding such as Latin-1, or the data was never text.
Why do I get an odd number of hex digits error?
Every byte is exactly two hex digits, so hex for whole bytes always has an even number of digits. An odd count means a digit was lost or added when copying, and decoding would shift every byte after it.
Is my data uploaded?
No. Everything runs in your browser.
Related tools
Text to Binary Converter
This text to binary converter shows the UTF-8 bits behind any text, in both directions.
UTF-8 Converter & Inspector
This UTF-8 inspector breaks text down character by character, with code points and bytes.
Reverse Hex (Endianness Swapper)
This tool swaps the byte order of a hex value, converting between big and little endian.
Number Base Converter
A number base converter for binary, hex, decimal, octal, Roman numerals, balanced ternary, negabinary and more.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text, entirely in your browser, with full UTF-8 support.