What binary code is
Computers store everything as bits, tiny switches that are either off (0) or on (1). Eight bits make a byte, and one byte can hold a number from 0 to 255. Text is stored by giving every character a number and saving that number in binary.
For plain English text, those numbers come from ASCII. The capital letter H is 72, which is 01001000 in binary. The small letter i is 105, which is 01101001. Put them together and you get Hi.
How to use the binary translator
Text to binary. Type in the Text box. The binary appears in the Binary box, one group of 8 digits for each byte. Press Copy to take it.
Binary to text. Paste binary into the Binary box. The text appears on the left. The translator accepts:
- groups separated by spaces, commas or new lines, such as
01001000 01101001 - one long string, as long as its length is a multiple of 8
- short groups without leading zeros, such as
1001000 1101001
If something is wrong, the message under the boxes says what, for example that a group is longer than 8 bits or contains a digit other than 0 or 1.
Space between bytes turns the gaps on or off in the output. Clear empties both boxes.
Number to binary. The second panel is a number base converter. Type a whole number into Decimal number, Binary, Hexadecimal or Octal and the other three fill in. Negative numbers work, and so do numbers far larger than a calculator can show, because the tool uses arbitrary precision integers. Each box has its own Copy button.
How the translation works
Text is first encoded as UTF-8 bytes. Each byte is then written as an 8-digit binary number, padded with zeros on the left. To read binary, the tool reverses the steps: it splits the digits into bytes and decodes the bytes as UTF-8.
Converting a number works by place value. In binary each place is worth twice the one to its right: 1, 2, 4, 8, 16 and so on. The number 42 is 32 + 8 + 2, so its binary form is 101010.
Examples: text to binary
| Text | Binary |
|---|---|
A |
01000001 |
a |
01100001 |
0 |
00110000 |
| space | 00100000 |
Hi |
01001000 01101001 |
é |
11000011 10101001 |
€ |
11100010 10000010 10101100 |
Notice that the digit 0 is not 00000000. The character “0” has its own code, 48.
Examples: numbers to binary
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 2 | 10 |
2 |
2 |
| 10 | 1010 |
A |
12 |
| 42 | 101010 |
2A |
52 |
| 100 | 1100100 |
64 |
144 |
| 255 | 11111111 |
FF |
377 |
| 1024 | 10000000000 |
400 |
2000 |
| 2026 | 11111101010 |
7EA |
3752 |
Tips and limits
- Use spaces when you can. Spaced binary is easier to check, and a missing digit in one group does not shift every letter after it.
- Text binary and number binary are different things. The text “42” becomes two bytes,
00110100 00110010. The number 42 is101010. Use the top panel for text and the lower panel for numbers. - Negative numbers are shown with a minus sign, such as
-1010for -10, not in two’s complement form. - Binary is not secret. It is just another way to write the same data.
Other ways to convert binary
Excel and Google Sheets. =DEC2BIN(42) returns 101010, and =BIN2DEC("101010") returns 42. In Excel, DEC2BIN only works from -512 to 511. For larger numbers use =BASE(2026, 2).
JavaScript. (42).toString(2) gives 101010, and parseInt('101010', 2) gives 42.
Python. format(42, '08b') gives 00101010. For text, ' '.join(format(b, '08b') for b in 'Hi'.encode()) gives 01001000 01101001.
Related tools
To see the same bytes in a shorter form, use the hex to text converter. The UTF-8 encoding tool explains why some characters take more than one byte. For another two-symbol code, try the Morse code translator.