Binary Calculator: Free Online Binary Math

Binary Calculator

Perform arithmetic and bitwise operations on binary, decimal, and hexadecimal numbers with instant multi-base results.

A binary calculator adds, subtracts, multiplies, divides and runs bitwise operations on binary numbers, then shows the answer in binary, octal, decimal and hex. This free tool is for students, programmers and anyone checking base-2 math. Enter two numbers, pick an operation, and read every base at once.

What Is Binary Arithmetic?

Binary arithmetic is math done in base 2, where every number is written with only the digits 0 and 1. Each position is worth a power of two, starting at 1 on the right and doubling as you move left: 1, 2, 4, 8, 16 and so on.

To read a binary number, add up the place values that hold a 1. For example, 1101 is 8 + 4 + 0 + 1, which equals 13 in decimal. Computers store everything this way because a circuit only needs to tell two states apart, on and off.

The basic addition rules

Binary addition has four cases: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 10 (write 0, carry 1). Subtraction, multiplication and division follow the same logic as decimal math, just with two digits instead of ten.

What bitwise operations do

Bitwise operations compare two numbers one bit at a time instead of treating them as quantities. AND keeps a bit only when both numbers have a 1 in that position. OR keeps it when either does. XOR keeps it when exactly one does. NOT flips every bit, and shifts slide all bits left or right.

How to Use the Binary Calculator

You can finish a calculation in about ten seconds by following these steps.

  1. Type your value into the First Number field (placeholder "Enter a number") and check the base menu next to it: Binary, Decimal or Hexadecimal.
  2. Open the operation menu and choose from the Arithmetic group (Add, Subtract, Multiply, Divide, Modulo, Power) or the Bitwise group (AND, OR, NOT, XOR, Left Shift, Right Shift).
  3. Type your value into the Second Number field and set its own base. The two numbers can use different bases, such as a binary value plus a hex value.
  4. Click Calculate, or press Enter while the cursor is in either number field.
  5. Read the Results panel: the Expression, then the answer in BIN, OCT, DEC and HEX. Use the copy button beside any line to grab that value.
  6. Click the swap button to exchange the two numbers and their bases, or click Reset to clear everything and start over.

NOT works on a single number, so the Second Number field disappears when you select it.

Automatic base detection

The base menu changes as you type. A value made only of 0s and 1s switches to Binary, a value containing digits 2 to 9 switches to Decimal, and any letter from a to f switches to Hexadecimal. If you meant decimal 101 and the menu jumped to Binary, change it back before you click Calculate.

Worked Example: Adding and Masking Binary Numbers

Here is a realistic run that shows how the same inputs behave under different operations.

Enter 1101 as the first number (Binary) and 1011 as the second (Binary), then choose Add. In decimal that is 13 + 11. The tool returns 11000 in BIN, 24 in DEC, 30 in OCT and 18 in HEX. Check it by hand: 8 + 4 + 1 = 13, 8 + 2 + 1 = 11, and 16 + 8 = 24, so 11000 is correct. The Bit Length detail tells you the answer needs 5 bits.

Now switch the same style of input to bitwise operations:

OperationInputsResult
Add1101 and 101111000 (24)
AND1100 and 10101000 (8)
XOR1100 and 1010110 (6)
Left Shift101 by 210100 (20)

The AND row shows the logic clearly. Only the leftmost bit is 1 in both 1100 and 1010, so only that bit survives. The shift row shows a handy rule: shifting left by 2 multiplies by 4, so 5 becomes 20.

How Do You Convert Binary to Decimal or Hex With It?

To convert a binary number to decimal or hexadecimal, enter it as the first number, choose Add, enter 0 as the second number, and read the DEC or HEX line. Adding zero leaves the value unchanged, so the Results panel works as a quick base converter.

For example, 10110111 in Binary plus 0 returns 183 in DEC and B7 in HEX. The reverse also works: enter a decimal such as 183 with the first base set to Decimal, add 0, and copy the BIN line. If you need to turn binary into readable text instead of numbers, use the binary to text translator.

How to Read and Act on the Results

The Results panel gives you the expression you entered and the answer in four bases, so you can pick the one your task needs. The Details block adds the Bit Length, the operation name, and the base used for each input.

  • BIN is the answer in base 2. Use it to check carries and bit patterns.
  • OCT is base 8, common in Unix file permissions.
  • DEC is the everyday value. Compare it with a manual decimal calculation to confirm your work.
  • HEX is base 16, common for memory addresses and color codes.
  • Bit Length shows how many bits the result needs. If it is larger than your target width (say 8 bits), the value will not fit and you need a wider field or a mask.

Common messages and fixes

  • "First number is not valid for base" or "Second number is not valid for base": a digit does not belong to the selected base, such as a 2 in a Binary value. Fix the digit or change the base menu.
  • "Division by zero" and "Modulo by zero": the second number is 0. Use any nonzero divisor.
  • "Result is not a finite number": the answer is too extreme to display, which can happen with Power. Lower the exponent.
  • "Please enter the first number" or "Please enter the second number": a required field is empty.

Who Uses a Binary Calculator?

A binary calculator helps anyone who needs to check base-2 work quickly without converting everything to decimal by hand.

  • Computer science students verify homework on binary addition, subtraction and multiplication, and compare their carries with the BIN output.
  • Programmers test masks and flags. For example, hex FF AND hex 0F returns hex F (15), which isolates the low four bits of a byte.
  • Networking learners practice with binary values when working through subnet masks and address bits.
  • Electronics hobbyists check register values and XOR results for logic circuits.
  • Teachers build quick examples that show the same number in four bases side by side.

If you are working with plain averages rather than base-2 values, the average calculator is a better fit.

Best Practices and Common Mistakes

Most wrong answers come from a wrong base, not a wrong operation, so check the base menus first.

  • Confirm both base menus before you click Calculate. Auto-detection guesses from what you type, and a decimal number like 1001 will be read as binary unless you change the menu.
  • Do not include prefixes or spaces. Type 1101, not 0b1101 or 1 101. Type B7, not 0xB7.
  • Remember that division is not always whole. 1101 divided by 10 is 13 divided by 2. Check the DEC line to see exactly what the tool returns, and use Modulo when you want the remainder (13 % 2 = 1).
  • Use Swap for subtraction mistakes. Order matters in Subtract, Divide, Modulo, Power and the shifts. If you entered the numbers backward, click the swap button and calculate again.
  • Verify a result by reversing it. If 11000 minus 1011 returns 1101, you know the earlier addition was right.
  • Match the shift amount to the operation. In a shift, the second number is how many places to move, not a value to combine.

Limits and Accuracy Notes

The calculator handles whole-number math across Binary, Decimal and Hexadecimal inputs and prints results in four bases. It follows standard rules for each operation, but you should know its scope.

  • It shows the expression and the final answer, not a column-by-column working. If you need the steps, use the carry rules above and compare each stage with the BIN output.
  • It does not include a separate two's complement or fixed-width mode. For NOT and negative results, check the Bit Length and DEC values against the word size your project uses, such as 8 or 32 bits.
  • It does not convert binary to words or text. Use the translator linked above for that.
  • Octal appears only in the results, not as an input base.

Treat the tool as a reliable check for your own work, and still read the Bit Length before you reuse a value in code.

You now have everything you need to run binary math, bitwise masks and base conversions in one place. Enter your first number above, choose an operation and click Calculate. For more utilities like this, browse the online calculators and utilities collection.

Frequently Asked Questions

How do you calculate binary numbers?
Calculate binary numbers by working right to left with two digits, carrying whenever a column adds up to 2. For example, 1 + 1 = 10, so write 0 and carry 1. The Binary Calculator checks your work: enter both numbers, choose an operation, and compare the BIN result with your own.
How do I convert binary to decimal with this calculator?
Enter the binary number as the first number, choose Add, enter 0 as the second number, and click Calculate. The DEC line shows the decimal value. For instance, 1011 plus 0 returns 11 in decimal and B in hex.
What operations does the binary calculator support?
The Binary Calculator supports Add, Subtract, Multiply, Divide, Modulo and Power, plus the bitwise operations AND, OR, NOT, XOR, Left Shift and Right Shift. It is free to use and needs no sign-in. Results appear in binary, octal, decimal and hexadecimal at the same time.
Can I enter decimal or hexadecimal numbers instead of binary?
Yes. Each number has its own base menu with Binary, Decimal and Hexadecimal, so you can mix bases in one calculation. The menu also changes automatically as you type, so check it before calculating, especially for values like 1001 that could be decimal or binary.
Does the binary calculator show step-by-step solutions?
No. The Binary Calculator shows the expression, the answer in BIN, OCT, DEC and HEX, and details such as bit length. It does not list carries column by column. To check your own steps, compare each stage of your work with the BIN output.
Why does the calculator say the number is not valid for the base?
That message means a digit does not belong to the selected base, such as a 2 in a Binary value or a letter g in Hexadecimal. Remove the invalid character or change the base menu beside that number, then click Calculate again.
Recommended

Explore VPN options

A VPN changes your network exit. It does not guarantee anonymity.

Hide Your IP Encryption Network coverage
Protect My IP Now