keencalculator
  1. Home
  2. Math
  3. Binary Calculator

Binary Calculator

Add, subtract, multiply or divide two binary numbers and see the answer in binary, decimal, octal and hexadecimal. Switch the number system to do the same arithmetic in hex or octal, or use AND, OR and XOR to combine bit masks. Numbers of any length are handled exactly.

Quick examples

Spaces, a minus sign and a 0b, 0o or 0x prefix are fine.

Your numbers stay in your browser. They are never uploaded.
Result10001
Remainder (division)
—
Result in decimal
17
Result in binary
10001
Result in octal
21
Result in hex
11
Same sum in decimal
11 + 6 = 17

Saved setups

Save a set of inputs you reuse — your usual rate, your loan, your room sizes — and load it back in one tap.

    Your recent calculations

    Results you calculate here are kept on this device so you can come back to them.

      Also free on iPhone and Mac

      Formula

      Binary place values from the right: 1, 2, 4, 8, 16…, so 1011 = 8 + 0 + 2 + 1 = 11
      Binary addition: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), 1 + 1 + 1 = 11 (write 1, carry 1)
      Hex digits: 0–9, then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15; place values 1, 16, 256, 4,096…
      AND gives 1 where both bits are 1; OR where either is 1; XOR where they differ

      How to use it

      1. Pick binary, octal or hexadecimal.
      2. Enter the two numbers and choose the operation.
      3. Read the result in your number system, with the same answer in the other bases below it.

      Worked examples

      Binary 1011 + 110 (11 + 6)

      Result
      10001
      Result in decimal
      17
      Result in hex
      11
      Result in octal
      21
      Same sum in decimal
      11 + 6 = 17

      Binary 1000 − 11 (8 − 3)

      Result
      101
      Result in decimal
      5

      Binary 101 × 11 (5 × 3)

      Result
      1111
      Result in decimal
      15
      Result in hex
      F

      Binary 11011 ÷ 101 (27 ÷ 5)

      Result
      101
      Remainder (division)
      10
      Same sum in decimal
      27 ÷ 5 = 5 remainder 2

      Hex FF + 1A (255 + 26)

      Result
      119
      Result in decimal
      281
      Result in binary
      100011001

      Hex F0 AND 3C, a bit mask

      Result
      30
      Result in decimal
      48
      Result in binary
      110000

      Octal 17 + 5 (15 + 5)

      Result
      24
      Result in decimal
      20

      A negative answer: binary 11 − 101 (3 − 5)

      Result
      -10
      Result in decimal
      -2

      Adding binary by hand

      For 1011 + 110, line the numbers up on the right. 1 + 0 = 1. Then 1 + 1 = 10: write 0, carry 1. Then 0 + 1 + the carry = 10: write 0, carry 1. Then 1 + the carry = 10: write 0, carry 1. Write the last carry at the front: 10001. In decimal that is 11 + 6 = 17.

      Subtraction works the same way with borrowing: 1000 − 11 = 101, or 8 − 3 = 5. Division gives a whole quotient and a remainder: 11011 ÷ 101 = 101 remainder 10, which is 27 ÷ 5 = 5 remainder 2.

      Negative numbers and bit masks

      Results here are ordinary signed numbers, so 11 − 101 shows as −10 (3 − 5 = −2). Computers usually store negative numbers in two’s complement at a fixed width, where −2 in 8 bits is 11111110. To get that form, add 2⁸ = 256 to the negative answer: −2 + 256 = 254 = 11111110.

      AND, OR and XOR work on numbers of zero or more. A common use is masking: F0 AND 3C keeps only the bits set in both, giving 30 in hex (240 AND 60 = 48).

      Questions people ask

      What is 1 + 1 in binary?

      10, which is 2 in decimal. You write 0 and carry 1 to the next place.

      What is 1011 + 110 in binary?

      10001. In decimal that is 11 + 6 = 17.

      What is FF + 1 in hex?

      100, which is 255 + 1 = 256 in decimal.

      How do I convert binary to decimal?

      Add the place values wherever there is a 1: 1011 = 8 + 2 + 1 = 11. Every answer here is also shown in decimal, octal and hex.

      Related calculators