How to use
- Choose Encode to turn text into binary, or Decode to turn binary back into text.
- Type or paste your text or binary digits, or open a file. The result updates as you type.
- Pick a separator for the 8-bit groups: space, none, comma or new line.
- Change the text encoding if your text is not UTF-8, then copy or download the result.
How text becomes binary
Computers store text as bytes. A text encoding such as UTF-8 maps every character to one or more bytes, and each byte is a number from 0 to 255. Written in base 2, that number needs at most eight digits, or bits. This converter writes every byte as exactly eight bits and keeps the leading zeros, so all groups have the same width and the binary code can be read back without guessing where one byte ends and the next begins.
Plain English letters, digits and punctuation take one byte each in UTF-8, so every character becomes one 8-bit group. Other characters take more: accented letters such as é use two bytes, most Chinese and Japanese characters use three, and emoji use four, so a single emoji turns into 32 bits. If you want one byte per character for Western European text, choose ISO-8859-1 or Windows-1252 in the Text encoding menu.
Translating binary back to text
In Decode mode, paste the bits as groups separated by spaces, commas or line breaks. Separated groups may drop their leading zeros, so output from tools that print 7-bit ASCII works too. A continuous string of 0s and 1s is split into 8-bit groups, so its length must be a multiple of 8. Any other character, or a group larger than 11111111 (255), is reported together with its position.
The bytes are then read with the selected text encoding. Pick the encoding that was used to create the binary, or switch the output to hex to see the raw bytes.
Text to binary in code
# Python
' '.join(f'{b:08b}' for b in 'Hi'.encode()) # '01001000 01101001'
bytes(int(g, 2) for g in '01001000 01101001'.split()).decode() # 'Hi'
// JavaScript
[...new TextEncoder().encode('Hi')]
.map(b => b.toString(2).padStart(8, '0')).join(' ') // '01001000 01101001'
Specification
| Alphabet | 0 1 |
|---|---|
| Output size | 8 digits per byte (800%) |
| Padding | None |
| Standard | Positional binary |
| Case sensitive | No |
Examples
| Input (UTF-8) | Output |
|---|---|
Hello, World! | 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01010111 01101111 01110010 01101100 01100100 00100001 |
Base64.is | 01000010 01100001 01110011 01100101 00110110 00110100 00101110 01101001 01110011 |
你好 | 11100100 10111101 10100000 11100101 10100101 10111101 |
Frequently asked questions
How many bits are in one character?
In ASCII, and for English letters in UTF-8, one character is one byte, which is 8 bits. Other characters take 16, 24 or 32 bits in UTF-8. In UTF-16 every character takes at least 16 bits.
Can I convert binary to text without spaces?
Yes, as long as the string is a continuous run of complete 8-bit groups. If your groups have fewer than 8 digits because leading zeros were dropped, keep them separated with spaces or commas so the decoder knows where each byte ends.
Is text to binary the same as converting a number to binary?
Is my text uploaded anywhere?
No. The conversion runs entirely in your browser, so the text and files you convert never leave your device.