Text to Binary & Hex Converter

Type in either box to turn text into the binary, octal, decimal, and hex of each UTF-8 byte, or decode those bytes back into text.

Base of the bottom box (also used to check what you paste)
Separator

All four bases

Every byte of the text in the top box, in all four bases at once. Separator and prefix follow the settings above.

How to Use

  1. Type or paste text into the top box and the bottom box immediately shows its UTF-8 bytes. The “All four bases” section below lists every byte in binary, octal, decimal, and hex at once, each with its own copy button.
  2. The setting for the bottom box picks the base: binary uses 8 digits per byte, octal 3, and hex 2. Decimal isn't padded when bytes are separated (65), and is padded to 3 digits when there's no separator (065) so it can be read back.
  3. Choose a space, a comma, or no separator, and optionally turn on the prefix switch, which puts the matching 0b, 0o, or 0x in front of each byte (decimal has none), ready to paste into code, for example 0x48, 0x69.
  4. Paste bytes into the bottom box to decode them. Spaces, commas, line breaks, and prefixes don't need cleaning up first, and hex is accepted in either case. Each group is checked against the selected base, and a run with no separators is split into groups of the fixed width.
  5. If there's a character that isn't a digit of the selected base, a group with the wrong number of digits, or a value above 255, the bottom box shows the character position and reason while the top box keeps its last good result. “Select the problem” highlights that part for you.
  6. If the decoded bytes aren't valid UTF-8, the result is still shown with a notice that they may come from another character encoding or that bytes are missing. � marks bytes that couldn't be read.
  7. “Swap” moves the result into the box you typed in. “Clear” empties both boxes.

FAQ

How does text become binary or hex? What about Chinese characters?

To store text, a computer first turns each character into one to four bytes using a character encoding, then stores those bytes as binary. This tool uses UTF-8, the most common encoding on the web. English letters and digits take 1 byte (A is 41, or 01000001 in binary), common Chinese characters and Japanese kana take 3 bytes (中 is E4 B8 AD), and emoji take 4 bytes (🍤 is F0 9F 8D A4). Binary, octal, decimal, and hex are just different ways of writing the same byte, so you can switch between them freely.

Is this encryption? Can't other people read my binary?

No. Converting to binary or hex is an encoding: it only writes the same data differently, with no key, so anyone can turn it back using the same rules. It doesn't hide anything. To protect content, use real encryption.

Why is decimal not padded, yet becomes three digits with no separator?

Decimal bytes vary in length (5, 65, and 228 have 1, 2, and 3 digits), which is fine when spaces or commas separate them. With “None”, the digits run together and the boundaries disappear, so each byte is padded to three digits (005, 065, 228) and read back three at a time. Binary, octal, and hex already have a fixed width.

What do “wrong number of digits” and “above 255” mean when decoding?

A byte is 8 bits, so binary needs 8 digits, hex 2, and octal 3, while decimal takes up to 3, and the value can't exceed 255 (hex FF, binary 11111111). A missing digit, an extra digit, or a bare 0x prefix with nothing after it is reported as an incomplete group with its position. An octal 400 or a decimal 256 and up is too big for one byte.

I see � or “not valid UTF-8” after decoding. What does it mean?

The bytes can't be turned back into text using UTF-8. Common causes are text that was originally in another character encoding such as Big5 or Shift_JIS, bytes in the wrong order, or some bytes missing. The tool still shows whatever it can read, with � marking the unreadable bytes, so you can see where things go wrong.