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, 345, each consecutive digit of this number corresponds to a different power of ten. That means that:

  • Digit 5 corresponds to 10⁰ (5 is equal to 5 * 10⁰).
  • Digit 4 corresponds to 10¹ (40 is equal to 4 * 10¹).
  • Digit 3 corresponds to 10² (300 is equal to 3 * 10²).

In the binary system, there are only two available digits: 0 and 1. That means that the digits of every number correspond to powers of 2 instead of corresponding to powers of 10. For example, we can analyze the number 1111 in the binary system in the following way:

  • The last 1 corresponds to 2⁰ (1 is equal to 1 * 2⁰ = 1).
  • The second-to-last 1 corresponds to 2¹ (10 is equal to 1 * 2¹ = 2).
  • Third-to-last 1 corresponds to 2² (100 is equal to 1 * 2² = 4).
  • The first 1 corresponds to 2³ (1000 is equal to 1 * 2³ = 8).

After adding all of these numbers, we get 1 + 2 + 4 + 8 = 15. Number 1111 in the binary system corresponds to 15 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 2.
  2. Note down the remainder. It is going to be equal to 0 or 1. 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 19, we would have the following steps:

  1. 19/2 = 9, remainder 1
  2. 9/2 = 4, remainder 1
  3. 4/2 = 2, remainder 0
  4. 2/2 = 1, remainder 0
  5. 1/2 = 0, remainder 1

Reading from the bottom to the top, 19 corresponds to 10011 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 2.
  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 2 and then adding the last digit.

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

  1. 1 * 2 = 2
  2. (2 + 1) * 2 = 6
  3. (6 + 0) * 2 = 12
  4. (12 + 0) * 2 = 24
  5. (24 + 1) * 2 = 50
  6. 50 + 1 = 51

110011 corresponds to 51 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: 0 means positive, 1 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 in the decimal system into an 8-bit binary system.

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

With these representations, you can make applications like binary subtraction without any problems.

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 to 127.

  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 87, is: 0101 0111.
  • The one's complement: 1010 1000.
  • The two's complement: 1010 1001.

The one's and two's complement are calculated as described above, flipping all digits for the opposite number and adding 1 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
People also viewed…

Billion to trillion converter

We designed this billion to trillion converter to help you to convert numbers from billions to trillions quickly and easily.

Christmas tree

Welcome to the Christmas tree calculator, where you will find how to decorate your Christmas tree in the best way. Take a look at the perfect Christmas tree formula prepared by math professors and improved by physicists. Plan in advance how many lights and decorations you'll need!

Fluid ounces to cups

Oz to cups converter is your buddy when it comes to counting how many fluid ounces there are in a cup and the other way round!

Grams to cups

The grams to cups calculator converts between cups and grams. You can choose between 20 different popular kitchen ingredients or directly type in the product density.
main background