HomeMath › Binary Calculator

Binary Calculator

Three binary tools in one card: do arithmetic on two binary numbers, convert any value between binary, decimal, and hexadecimal, or apply bitwise logic — AND, OR, XOR, NOT, and shifts. Every answer shows its decimal cross-check and working.

Binary result
Decimal
Hexadecimal
Steps

Binary, two’s complement, and bit widths

Binary is base 2: each place is worth twice the one to its right, so 10001 is 16 + 1 = 17. Computers store negative integers in two’s complement — invert all bits and add 1 within a fixed width, so −11 in 8 bits is 11110101. This page calculates mathematical values (a negative difference simply shows a minus sign), and the NOT operation lets you view the flipped pattern at 8, 16, or 32 bits, which is exactly the first step of forming a two’s complement.

How it’s calculated

Inputs are parsed as arbitrary-precision integers (base 2, 10, or 16), the operation is applied exactly, and the result is rendered back in all three bases. Division reports the integer quotient and remainder. AND/OR/XOR combine bits column by column; NOT computes mask − x at your chosen width; shifting left by k multiplies by 2ᵗ, shifting right divides and drops the remainder.

Bitwise results on values wider than the selected width keep their full length except NOT, which is only defined per width.

Worked example

1011₂ + 110₂: in decimal that is 11 + 6 = 17, and 17 back in binary is 10001 (or 11₁₆ in hex). Multiplying the same pair gives 1011 × 110 = 1000010 (66). Bitwise on 1011 and 0110: AND = 0010, OR = 1111, XOR = 1101, and 1011 « 2 = 101100 (11 × 4 = 44).

Common mistakes

  • Forgetting the carry rule 1 + 1 = 10 — the most common source of hand-worked errors.
  • Reading 10110 right-to-left when assigning place values; the leftmost bit is the largest power of 2.
  • Confusing bitwise AND with logical AND — bitwise compares every bit column, not just true/false.
  • Interpreting a leading 1 as a negative sign without agreeing on a bit width and two’s-complement encoding first.

Where it is used

  • Computer-science homework: base conversion and binary arithmetic drills.
  • Programming: masks, flags, permissions, and shift-based multiplication.
  • Networking: subnet masks and address math.
  • Digital electronics: register values and logic-gate behavior.

Frequently asked questions

How does binary addition work?

Exactly like decimal addition, but you carry at 2 instead of 10: 0+0=0, 0+1=1, and 1+1=10 (write 0, carry 1). So 1011 + 110 = 10001, which is 11 + 6 = 17 in decimal. The calculator shows the decimal cross-check for every operation.

How do I convert binary to decimal?

Multiply each bit by its place value (a power of 2) and add: 10110 = 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 22. Going the other way, repeatedly divide the decimal number by 2 and read the remainders bottom-up.

What is two’s complement?

It is how computers store negative integers in a fixed number of bits: invert every bit and add 1. In 8 bits, −11 is stored as 11110101. This calculator works with mathematical values, so a negative result shows a minus sign; use the NOT operation at a chosen bit width to see the inverted pattern.

What do the bitwise operations do?

AND keeps a 1 only where both inputs have 1 (1011 AND 0110 = 0010), OR keeps a 1 where either does (1111), XOR where exactly one does (1101), NOT flips every bit within the chosen width, and shifts slide the bits left (multiply by 2 per step) or right (divide by 2, dropping remainders).

How large can the binary numbers be?

Arithmetic and conversion run on arbitrary-precision integers, so hundreds of bits are fine. Bitwise NOT needs a fixed width to be meaningful, so it is offered at 8, 16, or 32 bits.