Binary Calculator
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free binary calculator. Add, subtract, multiply and divide binary numbers, or use AND, OR and XOR, with the answer in binary, decimal and hexadecimal.
- Decimal
- 0
- Hexadecimal
- 0
- Remainder
- 0
- Inputs in decimal
- 0
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the binary calculator
- Enter the first binary number, using only 0s and 1s. You can start it with a minus sign for a negative number.
- Choose an operation: add, subtract, multiply, divide, AND, OR or XOR.
- Enter the second binary number.
- Read the answer in binary, along with its value in decimal and hexadecimal. For division, the binary calculator also shows the remainder; and it shows both inputs in decimal so you can check your work.
The binary calculator uses exact whole-number arithmetic, so numbers with hundreds of digits work without rounding errors.
What binary is
Binary is a base-2 number system. Where decimal uses ten digits (0–9) and each place is worth ten times the one to its right, binary uses two digits (0 and 1) and each place is worth twice the one to its right:
| Place | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| 1011 | 1 | 0 | 1 | 1 |
So 1011 in binary is 8 + 0 + 2 + 1 = 11 in decimal, and 110 is 4 + 2 = 6. Computers use binary because their circuits have two states, on and off. Each binary digit is a bit, and eight bits make a byte.
To convert between binary, decimal, hexadecimal and octal, use the number base converter. To turn text into binary, use the binary translator.
Binary addition
Binary addition follows four rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
And with a carry, 1 + 1 + 1 = 11 (write 1, carry 1). Work from right to left, as with decimal addition.
1011 + 110:
1011
+ 0110
------
10001
Right column: 1 + 0 = 1. Next: 1 + 1 = 10, write 0 carry 1. Next: 0 + 1 + 1 = 10, write 0 carry 1. Next: 1 + 0 + 1 = 10, write 0 carry 1. Finally the carry: 1. The answer is 10001, which is 17 in decimal (11 + 6).
Binary subtraction
The rules:
- 0 − 0 = 0
- 1 − 0 = 1
- 1 − 1 = 0
- 0 − 1 = 1, borrowing 1 from the next column (which is worth 2 here)
1011 − 110 = 101 (11 − 6 = 5). If the second number is bigger, the result is negative, and the binary calculator shows it with a minus sign. Computers store negative numbers using two's complement (invert the bits and add 1), but a minus sign is clearer for working by hand.
Binary multiplication
Multiplication in binary is easier than in decimal, because you only ever multiply by 0 or 1. Write a shifted copy of the first number for each 1 in the second number, then add them up:
1011
× 110
---------
0000 (× 0)
10110 (× 1, shifted one place)
101100 (× 1, shifted two places)
---------
1000010
The answer is 1000010, which is 66 (11 × 6). Shifting a binary number one place to the left doubles it, just as adding a zero in decimal multiplies by ten.
Binary division
Binary long division works like decimal long division, but each step only asks whether the divisor fits (1) or not (0). 1011 ÷ 110 is 1 with a remainder of 101 (11 ÷ 6 = 1 remainder 5). The binary calculator gives the whole-number quotient and remainder, as integer division does in programming. For decimals and step-by-step working in base 10, see the long division calculator.
Bitwise AND, OR and XOR
Bitwise operations compare two numbers bit by bit, lined up from the right:
- AND: 1 only if both bits are 1. 1100 AND 1010 = 1000 (8).
- OR: 1 if either bit is 1. 1100 OR 1010 = 1110 (14).
- XOR (exclusive or): 1 if the bits are different. 1100 XOR 1010 = 0110 (6).
These are everywhere in computing:
- Masks and flags: AND with a mask tests or clears bits; OR sets them. File permissions work this way, as the chmod calculator shows.
- Networking: an IP address AND its subnet mask gives the network address. The subnet calculator does this for you.
- XOR tricks: XOR-ing a value twice with the same key gives back the original, which is used in simple checksums, graphics and some ciphers.
Hexadecimal: binary's shorthand
Long binary numbers are hard to read, so programmers group bits in fours and write each group as one hexadecimal digit (0–9 and A–F). 1000010 becomes 0100 0010, which is 42 in hex. A byte is always exactly two hex digits, which is why colours (#FF8800), memory addresses and hashes are written in hex. The binary calculator shows every answer in hex as well as decimal.
Powers of two worth knowing
- 2⁸ = 256: the number of values in a byte (0–255).
- 2¹⁰ = 1,024: why a kibibyte is 1,024 bytes.
- 2¹⁶ = 65,536; 2³² = 4,294,967,296 (the number of IPv4 addresses).
- 2⁶⁴ = 18,446,744,073,709,551,616.
The exponent calculator works out any power exactly.
Common mistakes
- Forgetting the carry when 1 + 1 makes 10.
- Misaligning numbers of different lengths; line them up from the right.
- Reading binary as decimal: 10 in binary is two, not ten.
- Mixing up AND/OR with addition: 1 OR 1 is 1, but 1 + 1 is 10.
Signed numbers and two's complement
Inside a computer, numbers are stored in a fixed number of bits, such as 8, 16, 32 or 64. For negative numbers, almost all modern hardware uses two's complement: to make −6 in 8 bits, write 6 as 00000110, flip every bit (11111001) and add 1, giving 11111010. The leading bit then acts as the sign. Two's complement lets the same adding circuit handle both positive and negative numbers, which is why it won out.
The binary calculator shows negative results with a minus sign instead, because a two's complement answer depends on how many bits you're using. To find the two's complement of a result for a given width, subtract its magnitude from 2 to the power of the width: in 8 bits, −6 is 256 − 6 = 250, which is 11111010.
Overflow
Fixed-width numbers can overflow. In 8 bits, the largest unsigned value is 255 (11111111); adding 1 wraps around to 0. In 32-bit signed integers, the largest value is 2,147,483,647, and adding 1 wraps to −2,147,483,648. Overflow bugs have caused real software failures, from video game glitches to crashes. The binary calculator works with unlimited length, so its answers never overflow; compare its result with your variable's size to spot an overflow risk.
Shifts
A left shift moves every bit one place left, multiplying by 2: 1011 shifted left is 10110 (11 becomes 22). A right shift divides by 2 and drops the remainder: 1011 shifted right is 101 (11 becomes 5). Programmers use shifts for fast multiplication and division by powers of two, and with AND masks to pull out groups of bits.
Binary in everyday technology
Binary underlies nearly everything digital. Text is stored as binary codes, with each character in UTF-8 using one to four bytes. Images are grids of pixels, each with binary numbers for red, green and blue. IP addresses are 32-bit (IPv4) or 128-bit (IPv6) binary numbers written in a friendlier form. Even file permissions on Linux and macOS are three groups of three bits. Working through sums with the binary calculator is a good way to build an intuition for how all of these work.
Practising binary arithmetic
The best way to get comfortable with binary is to work a few sums by hand, then check them. Start with small numbers you can verify in decimal, such as 101 + 11 (5 + 3 = 8, or 1000). Then try subtraction with borrowing, multiplication with shifts, and finally AND, OR and XOR. Enter each sum into the binary calculator to confirm your answer and see the decimal and hex values side by side.
A worked example
A computing student is checking her homework. She enters 1011 and 110 into the binary calculator and runs each operation:
- Add: 10001 (17)
- Subtract: 101 (5)
- Multiply: 1000010 (66, or 42 in hex)
- Divide: 1 remainder 101 (11 ÷ 6 = 1 remainder 5)
For the bitwise part of the worksheet she uses 1100 and 1010: AND gives 1000 (8), OR gives 1110 (14, E in hex) and XOR gives 110 (6). Each answer matches her working, and the decimal check shows the inputs are 12 and 10.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. That is the whole job of DeepRit: a PPC-only agency that sets up and runs Google Ads accounts so every click is accounted for. You keep full ownership of your account, get a written report every week, and can stop at any time. See our pricing or ask for a free audit.
Frequently asked questions
How do you add binary numbers?
Add column by column from the right: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1). 1011 + 110 = 10001.
What is 1 + 1 in binary?
10, which is two in decimal.
How do I convert binary to decimal?
Add the place values of each 1: from the right they're 1, 2, 4, 8, 16 and so on. 1011 = 8 + 2 + 1 = 11. The binary calculator shows decimal for every answer.
What does XOR do?
It gives 1 where the bits differ and 0 where they're the same. 1100 XOR 1010 = 0110.
Can the binary calculator handle negative numbers?
Yes, for arithmetic. Put a minus sign in front. Bitwise AND, OR and XOR work on positive numbers here.
Is the binary calculator free?
Yes. It's free, needs no sign-up, and works in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.