Skip to content
Case Converter Online
en

Binary Code Translator

Turn text into binary code and binary back into readable text. A second panel converts whole numbers between decimal, binary, hex and octal.

Works both ways. Each group of 8 digits is one byte of UTF-8 text.

Number to binary

Type a whole number in any box. Negative and very large numbers work.

Binary uses only 0 and 1. Each place is worth twice the one to its right.

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 is 101010. Use the top panel for text and the lower panel for numbers.
  • Negative numbers are shown with a minus sign, such as -1010 for -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.

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.

Binary Translator: questions and answers

How do I translate binary to text?

Paste the binary into the Binary box on the right. Groups of 8 digits separated by spaces work best, such as 01001000 01101001, which reads Hi. Binary without spaces also works if its length is a multiple of 8.

What is 'Hello' in binary?

Hello in binary is 01001000 01100101 01101100 01101100 01101111. Each group of 8 digits is one letter, using its ASCII code.

Why do some characters use more than 8 bits?

This translator uses UTF-8, the standard text encoding of the web. English letters, digits and common symbols fit in one byte. Accented letters use two bytes, the euro sign uses three and most emoji use four, so é becomes 11000011 10101001.

How do I convert a number to binary?

Type the number into Decimal number in the Number to binary panel. The binary, hexadecimal and octal values appear at once. 42 is 101010 in binary, and 255 is 11111111.

More code and data tools

See all tools