ToolsForWeb

Saved

Tap ☆ on any tool to keep it here.

toolsforweb

Text to Binary & Hex Converter

Convert text to binary, hex or decimal bytes, or decode bytes back to text.

Runs in your browser — nothing is uploaded

Loading tool…

Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.

About this tool

Computers store text as bytes. This converter shows those bytes for any text, written in binary (eight bits per byte), hexadecimal (two digits per byte) or decimal (0 to 255), and decodes bytes in any of those forms back to text. Text is encoded as UTF-8, the encoding of almost every web page and API, so plain ASCII letters take one byte each while accented letters, other scripts and emoji take two to four. Decoding accepts spaces, commas or line breaks between bytes and the usual 0x, \x and 0b prefixes. Digits that don't form whole bytes and byte sequences that aren't valid UTF-8 are reported rather than turned into garbled text. Everything runs in your browser.

How it works

text → UTF-8 bytes (0–255)
binary: 8 digits per byte
hex: 2 digits per byte

Each character becomes one to four UTF-8 bytes, and each byte is written in base 2, 16 or 10. Decoding parses the digits back into bytes and reads them as UTF-8 text.

Worked examples
QuestionWorkingAnswer
“Hi” in binaryH = 72, i = 10501001000 01101001
“Hi” in hex72 = 0x48, 105 = 0x6948 69
“é” in hexU+00E9 takes two UTF-8 bytesc3 a9
Decode binary 01001111 0100101179 = O, 75 = KOK

When to use it

Decoding a binary or hex message from a puzzle, CTF challenge or classroom exercise.
Checking exactly which bytes a string produces, for example when debugging an encoding problem.
Reading the hex dump of a short text value from a log, packet capture or database field.
Showing students how characters map to bits and bytes.

Questions

How do I convert text to binary?

Each character is turned into one or more bytes using UTF-8, and each byte is written as eight binary digits. H is byte 72, which is 01001000 in binary, and i is 105, or 01101001. So "Hi" becomes 01001000 01101001.

Why does one character produce several bytes?

UTF-8 uses one byte for the 128 ASCII characters and two to four bytes for everything else. é is two bytes (c3 a9 in hex), € is three (e2 82 ac) and most emoji are four. The byte count under the result shows the total.

Is this ASCII or UTF-8?

UTF-8. For the ASCII range, such as English letters, digits and common punctuation, UTF-8 and ASCII give identical bytes, so an ASCII table and this tool agree. Outside that range ASCII has no codes at all, and UTF-8 is the encoding the web uses.

Can I paste binary without spaces?

Yes. Without separators the digits are split into bytes of eight (binary) or two (hex), so the count must divide evenly. With spaces between bytes, shorter groups are fine, so 7-bit binary such as 1001000 decodes too.

Why do I get an "invalid UTF-8" error?

The bytes don't form valid UTF-8 text: a multi-byte sequence is cut short, or a byte such as ff appears that UTF-8 never uses. The input may be binary data such as part of an image, or text in an older encoding such as Latin-1 or Windows-1252.

Sources

Related tools