What is text in binary?

Computers store text as numbers. Every character is given a number by an encoding, and those numbers are stored as bytes of 8 bits, each bit a 0 or a 1. In ASCII and UTF-8 the letter H is 72, which is 01001000 in binary. Writing text as ones and zeros is a common way to teach how computers work, hide a message in a puzzle, or decorate a post.

Tool description

This tool converts text to binary and binary back to text. Type text to get its bytes in binary, or paste binary to read the text. Choose whether the bytes are separated by spaces, commas, new lines, or nothing at all. Use the swap button to turn the result around and check it.

Features

  • Text to binary and binary to text in one place
  • UTF-8 encoding, so accented letters, Cyrillic, Chinese, and emoji work as well as English
  • Separate bytes with a space, a comma, a new line, or nothing
  • Reads binary separated by spaces, commas, semicolons, or line breaks, or a run of bits with no separators
  • Accepts 7-bit ASCII groups, such as 1001000, and 0b prefixes
  • Explains what is wrong when binary cannot be read

How it works

Text is encoded as UTF-8. English letters, digits, and punctuation take one byte each, accented and Cyrillic letters take two, most Chinese and Japanese characters take three, and emoji take four. Each byte is written as 8 bits with leading zeros. When reading binary, every group between separators is one byte. A group longer than 8 bits, or bits with no separators, is split every 8 bits. The bytes are then decoded as UTF-8, and the tool reports an error if they do not form valid text.

Tips

  • A character that is more than one byte in UTF-8 has to be kept whole. Deleting one of its bytes makes the binary unreadable.
  • Binary from an old ASCII table may be written with 7 bits per character. Keep the spaces between the groups so each group is read as one character.
  • To show a single number in binary rather than text, use a number base converter instead.