Omni Calculator logo

Binary Converter

Created by Bogna Szyk and Philip Maus
Reviewed by Steven Wooding
Last updated: Jun 05, 2023


The binary converter is a handy tool that will enable you to perform a conversion of numbers quickly. You will be able to use it both as a binary to decimal converter and decimal to binary calculator. Read on to learn what is the binary system, how to convert the numbers, and how to use this calculator to obtain correct results.

And don't forget to check out our Mayan numerals converter to understand the Mayan numeral system and learn how to convert any number to Mayan numerals!

What is the binary system?

We usually operate in the decimal system. That means that we use ten different digits, from 0 to 9. If you write down a number, for example, 345345, each consecutive digit of this number corresponds to a different power of ten. That means that:

  • Digit 5 corresponds to 10010^0 (55 is equal to 5×1005 \times 10^0).
  • Digit 4 corresponds to 10110^1 (4040 is equal to 4×1014 \times10^1).
  • Digit 3 corresponds to 10210^2 (300300 is equal to 3×1023 \times 10^2).

In the binary system, there are only two available digits: 00 and 11. That means that the digits of every number correspond to powers of 22 instead of corresponding to powers of 1010. For example, we can analyze the number 11111111 in the binary system in the following way:

  • The last 11 corresponds to 202^0 (11 is equal to 1×20=11 \times 2^0 = 1).
  • The second-to-last 11 corresponds to 212^1 (10 is equal to 1×21=21 \times 2^1 = 2).
  • Third-to-last 11 corresponds to 222^2 (100100 is equal to 1×22=41 \times 2^2 = 4).
  • The first 11 corresponds to 232^3 (10001000 is equal to 1×23=81 \times 2^3 = 8).

After adding all of these numbers, we get 1+2+4+8=151 + 2 + 4 + 8 = 15. Number 11111111 in the binary system corresponds to 1515 in the decimal system.

Converting from decimal to binary

You can use a very simple and efficient algorithm to convert numbers from the decimal to binary system.

  1. Take your initial number. Divide it by 22.
  2. Note down the remainder It is going to be equal to 00 or 11. This will be the last digit of the binary number (the rightmost one).
  3. Take the quotient. It is your new "initial number".
  4. Keep repeating the above steps, each time adding the remainder to the left of previously obtained digits.

For example, for number 1919, we would have the following steps:

  1. 19/219/2 = 99, remainder 11
  2. 9/29/2 = 44, remainder 11
  3. 4/24/2 = 22, remainder 00
  4. 2/22/2 = 11, remainder 00
  5. 1/21/2 = 00, remainder 11

Reading from the bottom to the top, 1919 corresponds to 1001110011 in the binary system. Check this result with the binary converter!

Converting from binary to decimal

It is similarly straightforward – all you have to do is reverse the algorithm explained above:

  1. Take the leftmost digit of your initial number. Multiply it by 22.
  2. Add the next digit of the binary number. The sum will be your new "initial number".
  3. Keep repeating these steps, each time first multiplying by 22 and then adding the last digit.

For example, for the binary number 110011110011, we would have the following steps:

  1. 1×2=21 \times 2 = 2
  2. (2+1)×2=6(2 + 1) \times 2 = 6
  3. (6+0)×2=12(6 + 0) \times 2 = 12
  4. (12+0)×2=24(12 + 0) \times 2 = 24
  5. (24+1)×2=50(24 + 1) \times 2 = 50
  6. 50+1=5150 + 1 = 51

110011110011 corresponds to 5151 in the decimal system. Check this result with the binary converter!

Converting negative numbers

We are used to simply adding a minus symbol in front of the number if we want to express a negative number in the decimal system. But the binary system does not allow the minus symbol. So how can we represent negative numbers in binary?

The general concept to express negative numbers in the binary system is the signed notation. That means that the first bit indicates the sign of the number: 00 means positive, 11 is a negative value. The signed notation has two representations:

  • The one's complement of a negative number in binary is achieved by switching all digits of the opposite positive number to opposite bit values.

  • The two's complement of a negative number in binary is achieved by switching all digits of the opposite positive number to opposite bit values and adding 1 to the number.

Let's look at an example to better understand the one's and two's complement. We want to convert the number 87-87 in the decimal system into an 8-bit binary system.

  1. Find the binary representation of the positive number 8787 in the decimal system: 0101 01110101\ 0111.
  2. Switch all digits to the opposite: 1010 10001010\ 1000. That's one's complement.
  3. Add 11 to the one's complement to get the two's complement: 1010 10011010\ 1001.

With these representations, you can make applications like binary subtraction without any problems. To learn more, you can visit the binary subtraction calculator or binary calculator.

However, to convert fractional numbers, you can't apply the same reasoning: find out how to do that with our binary fraction converter!

How to use the binary converter?

Finally, we can talk about how to use the binary converter. For example, we will transform the number -87 from the decimal to the binary system.

  1. Choose the number of bits. For our example, 8 bits are a good choice since they allow for a range from 128-128 to 127127.

  2. Enter your decimal value in the input field in the decimal to binary section. The calculator displays the result:

  • The binary value of the positive opposite of our number, so 8787, is: 0101 01110101\ 0111.
  • The one's complement: 1010 10001010\ 1000.
  • The two's complement: 1010 10011010\ 1001.

The one's and two's complement are calculated as described above, flipping all digits for the opposite number and adding 11 for the two's complement.

The converter also allows the inverse conversion from the binary to the decimal system. Simply type in your binary number in the according field, and see the result in the decimal format displayed below.

Bogna Szyk and Philip Maus
Binary representation
8-bit
Decimal to binary
You can enter a decimal number between -128 and 127.
Decimal
Binary to decimal
You can write a binary number with no more than 8 digits. You don't have to input leading zeros.
Binary
Check out 5 similar numeral systems converters 🧮
Binary to hexadecimalBinary to octalDecimal to hexadecimal… 2 more
People also viewed…

Inch-pounds to foot-pounds

Our inch-pounds to foot-pounds converter can help you to convert work, energy, and torque units from inch-pounds to foot-pounds.

Schwarzschild radius

Calculate the gravitational acceleration at the event horizon of a black hole of a given mass using the Schwarzschild radius calculator.

Sunbathing

Do you always remember to put on sunscreen before going outside? Are you sure that you use enough? The Sunbathing Calculator ☀ will tell you when's the time to go back under an umbrella not to suffer from a sunburn!

mg to tablespoon converter

Our mg to tablespoon converter will explain how to correctly switch between these two units for various substances.
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service