Uni-Sine
Computer ScienceData and logic

Binary calculator: conversions and binary addition with working

Binary is base 2: each place is worth double the one to its right (1, 2, 4, 8, 16 and so on), and each digit is 0 or 1. To read a binary number, add the place values under the 1s, so 101101 is 32 + 8 + 4 + 1 = 45. This binary calculator is our Number Base Converter: it converts between binary, decimal, octal, hex and any base up to 36 with the working, and adds binary numbers column by column with every carry shown.

It opens on 2623 in decimal, converted to binary. Open the full number base converter over this page to type your own.

Try it

Number Base Converter

Convert between binary, hex and decimal and add in binary

Go to its page

How to use the binary calculator

  1. Choose Convert or Add.
  2. To convert, type the Number, choose the base it's in under From (binary is 2), and the base for the working under To.
  3. Read the number in binary, octal, decimal and hexadecimal all at once, with the working for your chosen pair of bases and a place value chart.
  4. To add, choose the Base (2 for binary) and type the First number and Second number. The sum appears with the column addition set out and each carry above its column.
  5. To practise, press Random problem in the Practice section for conversions and binary additions.

It handles whole numbers of any length and fractions such as 0.101, and says when a fraction never ends in the new base. It converts and adds, but doesn't subtract, multiply or divide. For negative numbers and subtraction in binary, the two's complement converter shows how computers store them.

Binary to decimal

Write the place values above the digits, from 1 on the right, doubling each time. Add up the place values that have a 1 under them:

Place value32168421
Digit101101

So 101101 in binary is 32 + 8 + 4 + 1 = 45. Type 101101 with From set to binary, and the calculator shows 45 in decimal, 2D in hex and 55 in octal.

Decimal to binary

Divide by 2 again and again, writing down each remainder, until you reach 0. Then read the remainders from the last one back to the first. For 2623, the calculator's opening number:

DivideAnswerRemainder
2623 ÷ 213111
1311 ÷ 26551
655 ÷ 23271
327 ÷ 21631
163 ÷ 2811
81 ÷ 2401
40 ÷ 2200
20 ÷ 2100
10 ÷ 250
5 ÷ 221
2 ÷ 210
1 ÷ 201

Reading the remainders from the bottom up gives 101000111111. For small numbers, it can be quicker to subtract the biggest place value that fits and repeat: 13 = 8 + 4 + 1, which is 1101.

Binary to hex

Hex is base 16, and 16 = 2⁴, so each hex digit is exactly four binary digits (a nibble). Split the binary into groups of four from the right and convert each group: 10 to 15 are written A to F. For 11010110, the groups are 1101 = 13 = D and 0110 = 6, so the answer is D6. The calculator uses the same grouping method when you convert between binary and hex, and groups of three for octal.

Try one

practice
Pick an answer, then check it.
What is 11001 in binary as a decimal number?

Binary addition

Add column by column from the right, just like decimal, but you carry at 2 instead of 10:

Sum in a columnWriteCarry
0 + 000
0 + 1 or 1 + 010
1 + 101
1 + 1 + 1 (with a carry in)11

The calculator opens Add on 1011 + 110. From the right: 1 + 0 = 1; 1 + 1 = 0 carry 1; 0 + 1 + 1 = 0 carry 1; 1 + 1 = 0 carry 1; and the last carry gives a new column. The sum is 10001, which checks out: 11 + 6 = 17.

Watch for overflow: 1111 + 1 = 10000 needs a fifth bit. If a computer only has four bits to store the answer, the extra 1 is lost. Try a binary addition, then press Mark to check your answer in the Number Systems course.

Add two random binary numbers and type the sum in binary.

Press Mark to have your answer marked in the Binary, Hexadecimal & Decimal course.

Binary subtraction with two's complement

Computers subtract by adding a negative. In 4-bit two's complement, to work out 9 − 3, write 3 as 0011, flip every bit (1100) and add 1 to get −3 = 1101. Then add: 1001 + 1101 = 10110. Drop the carry out of the fourth column and the answer is 0110 = 6. The calculator here doesn't subtract, but you can do the addition step in Add mode and check −3 in the two's complement converter.

Binary fractions

After the binary point the place values halve: ½, ¼, ⅛ and so on. 0.101 in binary is ½ + ⅛ = 0.625. Going the other way, multiply the fraction by 2 and take the whole part as the next digit: 0.625 → 1.25 (1), 0.25 → 0.5 (0), 0.5 → 1.0 (1), so 0.101. Some decimals never end in binary: 0.1 becomes 0.000110011..., repeating forever. The calculator says so and shows the first places.

Common mistakes

  • Reading remainders top to bottom. In repeated division, the last remainder is the first (leftmost) digit.
  • Grouping from the left for hex. Group binary digits in fours from the right, adding zeros on the left if needed.
  • Carrying at 10. In binary, 1 + 1 is 10: write 0 and carry 1.
  • Forgetting the final carry, which can add a new column on the left.
  • Mixing up the place values. The rightmost digit is worth 1, not 2.

Common questions

How do you convert binary to decimal?
Write the place values 1, 2, 4, 8, 16 and so on from the right, then add the ones with a 1 under them. 101101 = 32 + 8 + 4 + 1 = 45.
How do you convert decimal to binary?
Divide by 2 repeatedly, writing down the remainders, until you reach 0. Read the remainders from the last to the first. Or subtract the largest powers of 2 that fit.
How do you add binary numbers?
Add column by column from the right. 1 + 1 makes 0 carry 1, and 1 + 1 + 1 makes 1 carry 1. 1011 + 110 = 10001.
Can the calculator subtract or multiply binary?
No, it converts and adds. Subtract by adding the two's complement of the second number, and multiply by shifting and adding, as in long multiplication.
What bases does it support?
Any base from 2 to 36, with binary, octal, decimal and hexadecimal shown together for every conversion.

Revision cards

Read the front, say your answer, then flip to check.

Where to go next

  • Solve it

    Number Base Converter

    Convert between binary, hex and decimal and add in binary

    Open the tool
  • Learn it

    Binary, Hexadecimal & Decimal

    How computers count, and how to convert between number systems

    Start the course
  • Test it

    AP Computer Science Principles

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Computer Science · CoursesLearn binary and hexadecimal: an interactive courseLearn binary and hex in 24 short sections: place value, binary, decimal and hex conversions, bits and bytes, binary addition, overflow and colour codes.