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

• Digit 5 corresponds to $10^0$ ($5$ is equal to $5 \times 10^0$).
• Digit 4 corresponds to $10^1$ ($40$ is equal to $4 \times10^1$).
• Digit 3 corresponds to $10^2$ ($300$ is equal to $3 \times 10^2$).

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^0$ ($1$ is equal to $1 \times 2^0 = 1$).
• The second-to-last $1$ corresponds to $2^1$ (10 is equal to $1 \times 2^1 = 2$).
• Third-to-last $1$ corresponds to $2^2$ ($100$ is equal to $1 \times 2^2 = 4$).
• The first $1$ corresponds to $2^3$ ($1000$ is equal to $1 \times 2^3 = 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 \times 2 = 2$
2. $(2 + 1) \times 2 = 6$
3. $(6 + 0) \times 2 = 12$
4. $(12 + 0) \times 2 = 24$
5. $(24 + 1) \times 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. 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$ 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…

### BMR - Harris-Benedict equation

Harris-Benedict calculator uses one of the three most popular BMR formulas. Knowing your BMR (basal metabolic weight) may help you make important decisions about your diet and lifestyle.

### Cubic meter to ton converter

Convert cubic meters to tons for any substance based on its density.

### Feet converter

The feet converter will help you convert feet to other units of length.

### Snowman

The perfect snowman calculator uses math & science rules to help you design the snowman of your dreams!