Skip to content

Binary Calculator

Convert numbers between decimal and binary, and add, subtract, multiply or divide binary numbers. You also see the decimal, hexadecimal and octal forms of each result.

Mode
Convert from

Decimal numbers may start with a minus sign. Binary numbers use only 0 and 1.

Binary

1100100

100 in decimal is 1100100 in binary. Divide by 2, keep each remainder, and read the remainders from the bottom up.

Binary
1100100
Decimal
100
Hexadecimal
64
Octal
144

How to use this calculator

  1. 1 Choose Convert to change a number between decimal and binary, or Arithmetic to work with two binary numbers.
  2. 2 Type your number. Binary numbers use only the digits 0 and 1. Spaces are ignored, so 1011 0110 is fine.
  3. 3 Read the result, then check the other bases below it.
  4. 4 For a decimal number, use a minus sign for a negative value.

What is binary?

Binary is a number system with only two digits, 0 and 1. Our everyday decimal system has ten digits, from 0 to 9. The word “binary” comes from “two”, because each place in a binary number is worth two times the place to its right.

Computers use binary because electronic circuits are most reliable with two states, such as on and off. Each 0 or 1 is one bit, and a group of eight bits is one byte.

Binary is not harder than decimal. It just counts with fewer digits, so numbers need more places to be written out.

Reading a binary number

Each place in a binary number has a value that doubles as you move left: 1, 2, 4, 8, 16, 32, and so on. To read a number, add up the place values where there is a 1. The zeros add nothing.

For example, 1011 has a 1 in the 8s place, a 0 in the 4s place, a 1 in the 2s place and a 1 in the 1s place. So 1011 is 8 + 2 + 1 = 11 in decimal.

Reading 1011 in binary
Place value8421
Binary digit1011
Value8021

Converting decimal to binary

To change a decimal number into binary, divide by 2 and keep each remainder. Keep dividing the result by 2 until you reach 0. Then read the remainders from the bottom up.

Take 13. Dividing 13 by 2 gives 6 remainder 1. Then 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, and 1 ÷ 2 = 0 remainder 1. Reading the remainders from the bottom gives 1101. Check it: 8 + 4 + 1 = 13.

The calculator does all of this, and shows the binary, decimal, hexadecimal and octal forms together.

Binary arithmetic

Binary addition uses the same column method as decimal, but you carry at 2 instead of 10. The only tricky case is 1 + 1, which is 10 in binary: write 0 and carry 1. For example, 1011 + 101 = 10000, which is 11 + 5 = 16.

Multiplication is simpler. Each digit is 0 or 1, so you either add the number or add nothing. For 101 × 11, that is 5 × 3 = 15, which is 1111 in binary.

Division works like long division. For 1011 ÷ 101, the quotient is 10 and the remainder is 1. In decimal, 11 ÷ 5 = 2 remainder 1. For more on this method, see the long division calculator.

Binary in computing

A group of 8 bits is one byte. The largest value one byte can hold is 11111111, which is 255 in decimal. Bytes are the usual unit for computer memory and file sizes.

Larger numbers use more bits. A 32-bit number can hold values up to 4,294,967,295. Hexadecimal is often used as a shorter way to write binary, because each hex digit stands for four bits. The hex calculator converts between the two.

Programmers also use binary when they work with text encoding, such as base64, which packs bits into printable characters.

The formula

Binary to decimal

value = dₙ×2ⁿ + … + d₂×2² + d₁×2¹ + d₀×2⁰

dₖ
the digit (0 or 1) in position k, counting from the right starting at 0
2ᵏ
the place value of that position: 1, 2, 4, 8, 16 and so on

Decimal to binary

Divide by 2 and keep the remainder. Repeat on the quotient until it is 0, then read the remainders from last to first.

r
each remainder is 0 or 1 and becomes one binary digit

Division with remainder

a = q × b + r, where 0 ≤ r < b

q
the quotient: the whole number of times b fits into a
r
the remainder left over

Worked example

Add 1011 and 101 in binary

  1. 1.1011 in decimal is 1×8 + 0×4 + 1×2 + 1×1 = 11.
  2. 2.101 in decimal is 1×4 + 0×2 + 1×1 = 5.
  3. 3.11 + 5 = 16.
  4. 4.16 in binary is 10000, one 16 and nothing smaller.

1011 + 101 = 10000 in binary, which is 16 in decimal.

Frequently asked questions

How do I convert decimal to binary by hand?

Divide the number by 2 and write down the remainder. Keep dividing the quotient by 2 until it reaches 0. Reading the remainders from the last one to the first gives the binary number.

Why do computers use binary?

Digital circuits have two stable states, on and off, which map directly to 1 and 0. Every number, letter and instruction a computer handles is stored as a pattern of these bits.

What does integer division mean for binary numbers?

It works like ordinary division with a remainder, except the quotient is a whole number. For example, 1011 ÷ 101 gives a quotient of 10 and a remainder of 1, because 11 ÷ 5 is 2 remainder 1.

Can this calculator handle negative numbers?

Yes. Decimal inputs can start with a minus sign, and a negative result is shown with a minus sign in front of its binary digits. The calculator does not use two’s complement, the form some processors use internally.

Sources

Last reviewed by the GridCalculators team.