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.
Number Base Converter
Convert between binary, hex and decimal and add in binary
How to use the binary calculator
- Choose Convert or Add.
- To convert, type the Number, choose the base it's in under From (binary is 2), and the base for the working under To.
- 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.
- 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.
- 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 value | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|
| Digit | 1 | 0 | 1 | 1 | 0 | 1 |
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:
| Divide | Answer | Remainder |
|---|---|---|
| 2623 ÷ 2 | 1311 | 1 |
| 1311 ÷ 2 | 655 | 1 |
| 655 ÷ 2 | 327 | 1 |
| 327 ÷ 2 | 163 | 1 |
| 163 ÷ 2 | 81 | 1 |
| 81 ÷ 2 | 40 | 1 |
| 40 ÷ 2 | 20 | 0 |
| 20 ÷ 2 | 10 | 0 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
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
Binary addition
Add column by column from the right, just like decimal, but you carry at 2 instead of 10:
| Sum in a column | Write | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 or 1 + 0 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 (with a carry in) | 1 | 1 |
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?
How do you convert decimal to binary?
How do you add binary numbers?
Can the calculator subtract or multiply binary?
What bases does it support?
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