Computers store text as numbers, and numbers as bits. A binary translator turns
one into the other: each character of your text becomes one or more bytes in UTF-8,
and each byte is written as eight digits of 0 and 1. A is 01000001. Paste
binary back in and it reads the bytes as text again.
A space between each byte, like 01001000 01101001. Easier to read and to check by eye.
11 bytes (88 bits) of UTF-8. Runs in your browser. Nothing you type is uploaded.
Type in the left box and it converts as you go. Choose Text to binary to write text as zeros and ones, or Binary to text to read them back. Switch the Separator to put a space between each byte or none at all. Decode this sends the result back round the other way, so a round trip is one click. The count above the result is the number of bytes, which is the number of eight-digit groups.
How text becomes binary
- Look up each character's code point.
Ais 65. - Write the code point as UTF-8 bytes. For the 128 ASCII characters that is one byte with the same value, 65. Everything else takes two to four bytes.
- Write each byte in base 2, padded on the left with zeros to eight digits. 65 is
1000001, padded to01000001. - Join the groups, with a space between them if you want it readable.
| Character | Bytes | Binary |
|---|---|---|
A | 1 | 01000001 |
a | 1 | 01100001 |
0 | 1 | 00110000 |
| space | 1 | 00100000 |
é | 2 | 11000011 10101001 |
€ | 3 | 11100010 10000010 10101100 |
🐱 | 4 | 11110000 10011111 10010000 10110001 |
Capital and lower-case letters differ by one bit: the third from the left, which is
0 in A and 1 in a. That is why the table has 01000001 and 01100001.
Reading binary
Group the digits in eights from the left and convert each group to a number. Read
01001000 01101001 as 72 and 105, which are H and i. A string of digits whose
length is not a multiple of eight cannot be whole bytes, and the tool says how many
bits the last group has rather than padding it for you.
Gotchas
- Eight digits per byte, always.
1000001is the same number as01000001, but a translator needs the leading zero to know where each byte ends. - One character is not always one byte. The binary for
éis two groups and for an emoji four. Splitting the text by eight digits per character gets anything beyond plain English wrong. - Only 0 and 1. A
2, a letter, or a0bprefix is reported with its position instead of being skipped. Spaces and line breaks are the only thing ignored. - The bytes have to be UTF-8. Binary from another encoding, or from a file, has no text to show and the tool says so.
- Binary is not secret. It is another way of writing the same text. Anyone can translate it back, so do not use it to hide anything.
Related
- Base64 Encoder and Decoder, another way to write the same bytes as text, using 64 characters instead of two.
- URL Encoder and Decoder, which writes the same UTF-8 bytes as percent-escapes in hex.
- Hash Generator, for the fixed-length digest of some text rather than a reversible encoding.
- The Python cheat sheet for
int(x, 2)andstr.encode. - The JavaScript cheat sheet for
toString(2)andparseIntwith a base.
Common questions
How do I translate text to binary?
Type or paste the text into the left box with Text to binary selected. Each character is converted to its UTF-8 byte or bytes, and each byte is written as eight binary digits. The letter A is 65, which is 01000001. A space between the groups is the default and you can switch it off with the Separator setting.
How do I translate binary to text?
Switch to Binary to text and paste the zeros and ones. Spaces, tabs and line breaks between the groups are fine and ignored, so 01001000 01101001 and 0100100001101001 both read as Hi. The digits are split into groups of eight, each group is a byte, and the bytes are read as UTF-8 text.
Why does it say my binary is not a multiple of 8?
Text is stored as bytes and a byte is eight bits, so a binary string for text always has a length that divides by eight. Seven-bit ASCII with the leading zero dropped, a digit lost in copying, or an extra stray digit all break that. The tool tells you how many bits the last group has instead of padding it and guessing.
Why is an emoji or é more than eight digits?
Only the first 128 characters, the ASCII ones, fit in a single byte. UTF-8 writes an accented letter like é as two bytes, most Chinese and Japanese characters and the euro sign as three, and an emoji as four. The tool shows the byte count so you can see it: the cat emoji is 4 bytes, 32 bits.
Is binary the same as ASCII?
Not quite. ASCII is a table that gives 128 characters a number, such as 65 for A. Binary is how that number is written, in base 2. UTF-8, which this tool uses, matches ASCII for the first 128 characters, so for plain English text the output is the same as an ASCII to binary table.
Why does the decoder say the bytes are not valid UTF-8?
The bits made whole bytes, but those bytes do not spell text in UTF-8. The usual causes are binary from another encoding such as Latin-1, binary from a file rather than a message, or a multi-byte character that has been cut short. The tool reports it instead of showing replacement characters.
Is anything I paste here sent to a server?
No. The translation runs in your browser and neither box is submitted anywhere. The site records that the tool was used, in which direction and with which separator, and how long the input was, so we know which tools are worth building next. The text itself is never part of that.