About this tool
Add, subtract, multiply and divide binary numbers, run AND, OR, XOR, NOT and shifts, with 8–64-bit two's complement, carries and a bit grid.
This binary calculator does arithmetic and bitwise logic on base-2 numbers of any length. Type two binary numbers, pick an operation — add, subtract, multiply, divide with remainder, AND, OR, XOR, NOT, NAND, NOR, XNOR, shifts or rotates — and the answer appears instantly in binary, decimal, hexadecimal and octal. Switch to Unsigned or Signed (two's complement) mode with an 8, 16, 32 or 64-bit width to see overflow and wrap-around the way a CPU handles it. The working shows column addition with every carry, long multiplication, long division and bit-by-bit logic, and a bit grid lets you flip individual bits. Numbers use JavaScript BigInt, so nothing is rounded, and everything runs in your browser.
Open Binary Calculator on AltFTool — it loads instantly in your browser.
Type binary numbers into A (binary) and B (binary); spaces are ignored, and a 0x or 0d prefix lets you enter a hex or decimal value instead.
Choose an operation under Arithmetic, Bitwise logic or Shifts and rotates — for example + for addition, ÷ for quotient and remainder, or XOR.
Pick a Number mode: Unlimited for any length, or Unsigned / Signed (2's comp.) with a Bit width of 8, 16, 32 or 64 bits.
Read the Result card in binary, decimal, hex and octal, flip bits in the Bit grid, and follow the carries in the Working card; use Copy result or Copy all to export.
Four arithmetic operations, six logic gates, NOT, negate, left and right shifts (arithmetic and logical) and rotates, all on the same two inputs.
Unsigned and two's complement modes at 8, 16, 32 and 64 bits wrap results exactly like hardware registers and warn you when an overflow happens.
Carries and borrows are written above each column, long multiplication shows each shifted partial product and long division shows every bring-down step.
Unlimited mode handles binary numbers thousands of digits long without rounding, because the arithmetic uses arbitrary-precision integers.
| Decimal n | Binary | Hex | −n in 8-bit two's complement |
|---|---|---|---|
| 0 | 0 | 0 | 00000000 |
| 1 | 1 | 1 | 11111111 |
| 2 | 10 | 2 | 11111110 |
| 3 | 11 | 3 | 11111101 |
| 4 | 100 | 4 | 11111100 |
| 5 | 101 | 5 | 11111011 |
| 6 | 110 | 6 | 11111010 |
| 7 | 111 | 7 | 11111001 |
| 8 | 1000 | 8 | 11111000 |
| 9 | 1001 | 9 | 11110111 |
| 10 | 1010 | A | 11110110 |
| 11 | 1011 | B | 11110101 |
| 12 | 1100 | C | 11110100 |
| 13 | 1101 | D | 11110011 |
| 14 | 1110 | E | 11110010 |
| 15 | 1111 | F | 11110001 |
| 16 | 10000 | 10 | 11110000 |
To get −n in two's complement, invert every bit of n and add 1. For example 5 = 00000101, inverted 11111010, plus 1 gives 11111011 = −5.
Add column by column from the right, just like decimal, but carry when a column reaches 2. The four rules are 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). For example 1011 + 110 = 10001, which is 11 + 6 = 17 in decimal. The Working card shows each carry.
Subtract column by column from the right. When the top bit is 0 and the bottom bit is 1, borrow 1 from the next column, which is worth 2 in the current one, so 10 − 1 = 1. Computers instead add the two's complement: A − B = A + (NOT B + 1), discarding any carry out of the bit width. Both methods are shown here.
Binary long multiplication is simple because each digit of the multiplier is 0 or 1. For every 1 in B, write a copy of A shifted left by that bit's position, then add the rows. For example 1101 × 101 = 1101 + 110100 = 1000001, which is 13 × 5 = 65. Shifting left by one place doubles a binary number.
Binary long division brings down one bit at a time. If the current value is at least the divisor, write 1 in the quotient and subtract; otherwise write 0. Continue until all bits are used, and what is left is the remainder. For example 110111 ÷ 101 gives quotient 1011 and remainder 0, which is 55 ÷ 5 = 11.
Two's complement is the way computers store signed whole numbers. In an n-bit number the top bit has weight −2ⁿ⁻¹ instead of +2ⁿ⁻¹, so 8 bits cover −128 to 127. To negate a number, invert all the bits and add 1. Its big advantage is that addition and subtraction work the same for signed and unsigned values.
Overflow happens when the true result does not fit in the chosen number of bits. In 8-bit signed mode 127 + 1 should be 128, but the largest value is 127, so the pattern 10000000 is read as −128. In unsigned mode 255 + 1 wraps to 0. The calculator shows a warning with the true result and the allowed range.
They compare two numbers bit by bit. AND gives 1 only where both bits are 1, which is used to mask bits off. OR gives 1 where either bit is 1, used to set bits. XOR gives 1 where the bits differ, used to toggle bits and in checksums. NAND, NOR and XNOR are the inverted versions of these three.
Both move every bit to the right. A logical shift (>>>) fills the empty places on the left with zeros, so it treats the number as unsigned. An arithmetic shift (>>) copies the sign bit into them, so negative numbers stay negative and the result equals floor division by 2 for each place. Left shifts fill with zeros either way.
Multiply each bit by its place value — 1, 2, 4, 8, 16 and so on from the right — and add the results. For 1011 that is 8 + 0 + 2 + 1 = 11. This calculator shows the decimal, hex and octal value of both inputs and the result in the table under the Result card, so no separate conversion step is needed.
In Unlimited mode inputs can be up to 4,000 digits long and every result is exact, because the arithmetic uses arbitrary-precision integers rather than 64-bit floating point. The bit grid displays up to 128 bits and the column working is shown for up to 96 digits, so very long numbers still calculate but some visuals are skipped.
Add the Binary Calculator widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/binary-calculator"
title="Binary Calculator — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/binary-calculator?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>