Hex to Text Converter
NewConvert text to hexadecimal, or hex back to readable text. Choose UTF-8, UTF-16 or Latin-1, pick a hex format such as spaced bytes, 0x prefixes, \x escapes or a C array, and inspect the bytes in a hex dump. Hex input can be pasted in almost any common format. Everything converts as you type, locally in your browser.
How to convert text to hex
- Select Text to Hex and type or paste your text.
- Choose the character encoding. UTF-8 is right in most cases.
- Choose the hex format and, optionally, Uppercase hex.
- Copy the result.
For example, Hello in UTF-8 is 48 65 6c 6c 6f: one byte per letter. Characters outside ASCII take more bytes: é is c3 a9 and 😀 is f0 9f 98 80.
How to convert hex to text
- Select Hex to Text and paste the hex.
- Choose the encoding the bytes were written in.
- Read the text, and open Hex dump to inspect the bytes.
The hex can be written in any of these forms, and they can be mixed:
| Input | Example |
|---|---|
| Continuous | 48656c6c6f |
| Spaces, line breaks or tabs | 48 65 6c 6c 6f |
| Colons, commas, dashes or semicolons | 48:65:6c:6c:6f, 48-65-6c |
0x prefixes | 0x48 0x65 0x6c or 0x48, 0x65, 0x6c |
\x escapes | \x48\x65\x6c\x6c\x6f |
Upper and lower case both work. A single digit between separators is read as one byte, so 0x5 means 05. If a character isn't hex or a group has an odd number of digits, the tool shows its position, and Go to error selects it.
Which character encoding?
| Encoding | Bytes per character | Hé😀 in hex | Used by |
|---|---|---|---|
| UTF-8 | 1 to 4 | 48 c3 a9 f0 9f 98 80 | The web, Linux, JSON, most files and APIs |
| UTF-16 LE | 2 or 4 | 48 00 e9 00 3d d8 00 de | Windows, .NET and Java strings in memory |
| UTF-16 BE | 2 or 4 | 00 48 00 e9 d8 3d de 00 | Some network protocols and file formats |
| Latin-1 | 1 | 48 e9 (no emoji) | Old Western European systems |
If hex decodes to text with � characters, the bytes are not valid UTF-8: the tool shows where the first invalid byte is. Try UTF-16 or Latin-1 instead.
Reading the hex dump
The hex dump shows the bytes the way xxd and hexdump -C do: the offset of each line in hex, 16 bytes in two groups of eight, and the same bytes as ASCII, with dots for bytes that are not printable characters.
00000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a |Hello, world!.|
Convert hex in the command line and in code
echo -n 'Hello' | xxd -p # text to hex: 48656c6c6f
echo '48656c6c6f' | xxd -r -p # hex to text: Hello
echo -n 'Hello' | xxd # hex dump
// JavaScript (browser and Node.js)
Array.from(new TextEncoder().encode('Hello'), b => b.toString(16).padStart(2, '0')).join('');
Buffer.from('48656c6c6f', 'hex').toString('utf8'); // Node.js: "Hello"
'Hello'.encode('utf-8').hex() # '48656c6c6f'
bytes.fromhex('48 65 6c 6c 6f').decode('utf-8') # 'Hello'
Frequently asked questions
What is hexadecimal?
Hexadecimal is base 16: it uses the digits 0–9 and the letters a–f. Two hex digits describe exactly one byte (0 to 255), which makes hex a compact, readable way to show binary data, such as file contents, network packets or hashes.
Is hex the same as ASCII?
No. ASCII is a character set that gives each character a number, such as 72 for H. Hex is one way to write that number: 72 is 48 in hex. For plain English text, UTF-8 and ASCII give the same bytes.
Why does my hex convert to strange characters?
The bytes were probably written in a different encoding, or they are not text at all, such as an image or compressed data. Try another encoding, and check the hex dump to see which bytes are printable.
Is my data sent to a server?
No. Conversion runs in your browser as you type, and nothing is uploaded or saved. Only your encoding and format choices are remembered on your device.
Related tools
- Base64 encoder and decoder — Encode bytes as Base64 text instead of hex.
- URL encoder and decoder — Percent-encode text, which also writes bytes in hex.
- SHA-256 hash calculator — Hash text or hex bytes, with the result in hex.
- Keccak-256 hash calculator — Hash hex data for Ethereum.
Further reading
Last updated: