Text to Hex and Binary
Convert text to hexadecimal, binary or ASCII codes and back again. Free, instant and runs entirely in your browser.
Paste or type, or drop a file on the box.
Runs in your browser. Nothing you enter is uploaded or stored.
How to use the Text to Hex and Binary
- Choose Text to codes to convert text, or Codes to text to read codes back.
- Pick the number format: hex, binary, decimal or octal.
- Type or paste into the left box. The result appears on the right as you type.
- When converting text, choose what goes between bytes: a space, a comma, a new line or nothing.
- Copy the result, or press Swap to send it back the other way.
Questions and answers
- Is my text sent to a server?
- No. The conversion runs entirely in your browser. Nothing you type or paste is uploaded, stored or logged.
- How is text turned into hex or binary?
- Computers store text as bytes, each a number from 0 to 255. The tool encodes your text as UTF-8, then writes each byte in the format you chose. The letter A is byte 65, which is 41 in hex, 01000001 in binary and 101 in octal.
- Is this the same as ASCII codes?
- For English letters, digits and common punctuation, yes: UTF-8 and ASCII give the same single byte, so the decimal format shows the familiar ASCII codes. Characters outside ASCII, such as é, € or an emoji, take two to four bytes each in UTF-8.
- Why does one character give several bytes?
- UTF-8 uses one byte for plain English characters and more for everything else. The letter é becomes c3 a9, the euro sign becomes e2 82 ac, and most emoji take four bytes. When converting back, those bytes are joined into the original character.
- What formats can it read when converting back?
- Values can be separated by spaces, commas or line breaks. Hex can also be written with a 0x or \x prefix, or run together with no separators, such as 48656c6c6f. Binary can be run together too, in groups of eight digits. Decimal and octal need a separator between values.
- Why does it say the bytes are not valid UTF-8?
- Not every sequence of bytes is text. If the values are the contents of an image or another binary file, or use an older encoding such as Latin-1, they cannot be shown as UTF-8 text. Check that the values and the chosen format match.
Related tools
Base64 Encode and DecodeEncode text to Base64 or decode it back in your browser, with full UTF-8 support. Free, instant and nothing is uploaded.File to Base64Convert an image or any file to a Base64 string or data URI, and turn Base64 back into a file. Runs in your browser.URL Encode and DecodePercent-encode text for use in a URL or decode an encoded URL back to readable text. Free and runs in your browser.HTML Entity Encode and DecodeEscape special characters to HTML entities or convert entities back to plain text. Free and runs in your browser.Unicode Escape and UnescapeConvert text to Unicode escape sequences and code points, or turn escaped sequences back into readable characters.