How to Use the Binary Calculator
This page includes two tools: the Binary Arithmetic & Bitwise Calculator and the Binary Number Conversion Calculator. Follow these simple steps for each:
Using the Binary Arithmetic & Bitwise Calculator
- Choose your input format: Enter your numbers in either Binary (0s and 1s) or Decimal (base 10) format.
- Select an operation:
- Arithmetic: Addition (+), Subtraction (−), Multiplication (×), Division (÷), or Modulo (%).
- Bitwise logic: AND (&), OR (|), XOR (^), or NOT (~).
- Bit shifts: Left Shift («) or Right Shift (») with your chosen shift amount.
- Set the register width & sign (optional): Choose Auto for unrestricted numbers, or select a fixed width (8-bit, 16-bit, 32-bit, or 64-bit). Toggle between Unsigned and Signed (Two's Complement) to see how fixed-width registers handle negative values and overflow.
- View step-by-step results: The calculator instantly displays the result in binary, decimal, hexadecimal, and octal, along with carry chains, borrow steps, and visual derivations.
Using the Binary Number Conversion Calculator
- Enter the number to convert: Type any whole number into the input field.
- Select the source base (“From”): Choose the base of your input number (such as Base 2 for binary, Base 10 for decimal, Base 16 for hexadecimal, or any base from 2 to 36).
- Select the target base (“To”): Choose the base you want to convert the number into.
- Read the result and derivation: The converter displays the converted number along with the exact mathematical steps—showing power-of-2 polynomial expansion or repeated division by 2.
Binary Number System
What Is a Binary Number?
A binary number is a numerical value expressed in the base-2 (radix-2) numeral system. Unlike the standard decimal system (base-10), which uses ten distinct symbols (0 through 9) with positional weights corresponding to powers of 10, the binary system represents all quantities using only two mathematical symbols: 0 and 1.
Each binary digit is called a bit (a portmanteau of binary digit). In positional notation, a binary number represents a sum of powers of 2. For an integer with bits dk−1 … d1d0 where each di ∈ {0, 1}, the value in decimal is determined by the polynomial expansion:
For example, the binary sequence 1011₂ evaluates to:
Binary is the foundational numeral system of digital computing and information theory. Because electronic hardware operates using transistors that reliably maintain two discrete physical voltage levels—off (low voltage, logic 0) and on (high voltage, logic 1)—radix-2 arithmetic provides an unambiguous, noise-tolerant substrate for executing arithmetic, storing memory states, and evaluating Boolean logic.
How Binary Place Values Work
Starting from the rightmost bit (the least significant bit, or LSB at position 0), each position represents an increasing power of two:
| Bit Position (i) | Power of 2 (2i) | Positional Value |
|---|---|---|
| 0 | 20 | 1 |
| 1 | 21 | 2 |
| 2 | 22 | 4 |
| 3 | 23 | 8 |
| 4 | 24 | 16 |
| 5 | 25 | 32 |
| 6 | 26 | 64 |
| 7 | 27 | 128 |
So 11001010₂ becomes:
The important distinction is that the binary string itself is a representation, while its interpretation depends on the context. For example, the eight-bit pattern 11111101₂ has an unsigned value of 253, but under signed two's-complement interpretation it represents −3. The same bits therefore do not automatically imply the same signed numeric value.
Binary Arithmetic
Binary arithmetic follows the same column-by-column mathematical principles as decimal arithmetic, but each positional column contains only the digits 0 and 1.
Binary Addition Calculator
Binary addition uses the same column-by-column approach as decimal addition, but each digit can only be 0 or 1.
The basic rules are:
When a column produces 10₂, write 0 and carry 1 to the next column.
For example:
The calculator shows the carry propagation so you can verify each column of the addition.
Binary Subtraction Calculator
Binary subtraction uses borrowing in the same way as decimal subtraction. In fixed-width signed calculations, subtraction can also be represented by adding the two's complement of the second value.
For example:
When working with negative results or fixed register widths (such as 8-bit), the calculator shows both borrow steps and the equivalent two's-complement addition (e.g. 5 − 8 = −3), matching the subtraction hardware inside modern ALUs.
Binary Multiplication Calculator
Binary multiplication follows the shift-and-add principle because each multiplier digit is either 0 or 1.
For example:
1011 (11 in decimal)
× 101 (5 in decimal)
----------
1011 (1011 × 1)
0000 (1011 × 0, shifted 1)
+ 101100 (1011 × 1, shifted 2)
----------
110111 (55 in decimal)So 1011₂ × 101₂ = 110111₂, which is 11 × 5 = 55 in decimal. The same shift-and-add structure is fundamental to digital multiplier hardware.
Binary Division Calculator
Binary division follows the same long-division concept used in decimal arithmetic, but every digit is either 0 or 1. For integer division, the result consists of a quotient and a remainder.
For example:
When dividing numbers that do not divide evenly (e.g. 13 ÷ 5 = 2 remainder 3), the calculator displays both the integer quotient and the exact remainder.
Binary Modulo Calculator
Binary modulo returns the remainder after integer division.
For example:
The calculator explicitly validates modulo-by-zero rather than returning an invalid numerical result.
Bitwise Binary Calculator
Bitwise operations act on corresponding bits rather than treating an entire value as a single decimal quantity.
Bitwise AND (&)
Produces 1 only when both input bits are 1.
11001100 & 10101010 ---------- 10001000
Bitwise OR (|)
Produces 1 when at least one corresponding bit is 1.
11001100 | 10101010 ---------- 11101110
Bitwise XOR (^)
Produces 1 when corresponding bits are different.
11001100 ^ 10101010 ---------- 01100110
Bitwise NOT (~)
Reverses each bit within the register width.
~ 00001111 ---------- 11110000
XOR is widely used in low-level systems, masking, and cryptography. A crucial point is that NOT depends on the chosen width when interpreted as a fixed-size register. An eight-bit NOT operation and an unrestricted mathematical complement are not the same concept. For dedicated hexadecimal bitwise manipulation, examine our Hex Calculator.
Binary Bit Shift Calculator
A bitwise shift moves each bit in a binary word a specified number of positions to the left or right. In positional radix-2 mathematics, shifting scales numerical values by powers of two: shifting left by k positions multiplies by 2k, while shifting right divides by 2k. However, the precise hardware behavior depends heavily on whether the shift is logical or arithmetic.
Left Shift («)
Moves bits to the left, discarding the most significant bits (MSBs) that exceed the register boundary and filling all vacated least significant bit (LSB) positions with 0.
Left shifting is identical for both signed and unsigned values, but can trigger signed overflow if the sign bit flips.
Logical Right Shift (»» or >>>)
Moves bits to the right, discarding low-order bits and always inserting zeros into the vacated high-order positions, regardless of sign.
Ideal for manipulating raw bitmasks, pixel values, and unsigned integers.
Arithmetic Right Shift (»)
Unlike a logical right shift, an arithmetic right shift preserves the sign of signed two's-complement numbers by replicating the original sign bit (the MSB) into all vacated positions on the left. This process is known as sign extension:
8-Bit Binary Calculator
An 8-bit register contains exactly 8 binary digits. For unsigned values, an 8-bit register can represent values from 0 through 255.
For signed two's-complement values, the range is −128 through 127.
The meaning of a binary pattern therefore depends on the selected width and whether the value is interpreted as signed or unsigned.
The calculator also supports 16-bit, 32-bit and 64-bit register widths so you can examine fixed-width binary calculations at different sizes.
| Register Width | Unsigned Range [0, 2n − 1] | Signed Two's Complement [−2n−1, 2n−1 − 1] |
|---|---|---|
| 8-bit (Byte) | 0 to 255 | −128 to +127 |
| 16-bit (Word) | 0 to 65,535 | −32,768 to +32,767 |
| 32-bit (Dword) | 0 to 4,294,967,295 | −2,147,483,648 to +2,147,483,647 |
| 64-bit (Qword) | 0 to 18,446,744,073,709,551,615 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 |
16-bit
Traditional computer “word” size in legacy 16-bit x86 systems, TCP port numbers (0 to 65535), and audio sample depths.
32-bit
Standard integer size in C/C++, Java, IPv4 addresses, and 32-bit GPU color packing. Max unsigned: 4,294,967,295.
64-bit
Modern 64-bit CPU register width for memory pointers, timestamps, and BigInt exact integer arithmetic.
JavaScript's standard Number type guarantees exact integer representation only through 2⁵³ − 1 = 9,007,199,254,740,991. Beyond that point, consecutive integers lose precision. This calculator preserves integer values using exact BigInt arithmetic rather than passing them through floating-point approximations.
Signed vs Unsigned Binary
In digital computers, a memory cell or register stores only raw bits (0s and 1s) with no inherent positive or negative sign. Whether an 8-bit pattern like 11111101₂ represents 253 or −3 depends entirely on whether it is interpreted as unsigned or signed:
- Unsigned representation: All bits represent positive positional weights (2⁰, 2¹, 2², …). An 8-bit register spans 0 through 255.
- Signed representation (Two's complement): The most significant bit (MSB) carries a negative weight (−2n−1). An 8-bit register spans −128 through +127.
Two's Complement
Two's complement is the universal standard for representing signed integers in computer hardware. It eliminates duplicate representations of zero (unlike older systems with separate +0 and −0) and allows the CPU to perform both addition and subtraction using the exact same adder circuitry.
To calculate the two's complement of a positive binary number:
- Write the binary value at your fixed register width.
- Invert all bits (change 0 to 1 and 1 to 0).
- Add 1 to the result.
Overflow and Carry-Out
Fixed register widths introduce two distinct boundary conditions that are frequently confused:
- Carry-Out (Unsigned Overflow): Occurs when an addition generates a carry out of the most significant bit. For example, adding
255 (11111111₂) + 1 (00000001₂)in an 8-bit register produces00000000₂with a carry-out of 1. The hardware sets the Carry Flag (C) to signal that the true 9-bit result (256) exceeded the register's 8-bit capacity. - Overflow (Signed Overflow): Occurs when an operation on signed numbers yields a result outside the representable range [−128, +127]. For example, adding two positive numbers
127 + 1produces10000000₂, which wraps around to −128. The hardware sets the Overflow Flag (V) whenever adding two positive numbers yields a negative result, or adding two negative numbers yields a positive result.
Asymmetry notice: Because zero is grouped with positive numbers (MSB = 0), an n-bit two's-complement system always has one more negative value than positive. In 8 bits, −128 exists, but +128 does not; negating −128 produces −128 and triggers the overflow flag.
Binary Number Conversion
Binary numbers convert seamlessly into decimal, hexadecimal, octal, and arbitrary radix systems through positional expansion and repeated division:
Binary → Decimal
Multiply each binary digit by its corresponding power of 2, starting from 2⁰ on the right, and sum the results:
Decimal → Binary
Perform repeated integer division by 2, recording each remainder (0 or 1). Reading the remainders from bottom to top yields the binary representation:
Binary → Hexadecimal
Because 16 = 2⁴, each hexadecimal digit corresponds to exactly four binary bits (a nibble). Group bits in sets of four starting from the right:
Binary → Octal
Because 8 = 2³, each octal digit corresponds to exactly three binary bits. Group bits in sets of three from the right:
Base 2–36 Conversion
The platform supports base conversion across any radix from 2 through 36 using digits 0–9 and letters A–Z (where A=10, B=11, …, Z=35). Polynomial positional evaluation translates any input into an exact BigInt integer before converting to the target radix.
Step-by-Step Binary Calculator
This calculator does not only return the final binary value. It can display the intermediate work, including carry propagation during addition, borrow behavior during subtraction, bit-level changes for logic operations, and repeated-division steps for base conversion.
Inspect this worked step-by-step calculation showing intermediate stages and multi-base verification:
1011 (11 in decimal)
× 101 (5 in decimal)
----------
1011 (1011 × 1)
0000 (1011 × 0, shifted 1)
+ 101100 (1011 × 1, shifted 2)
----------
110111 (55 in decimal: 32 + 16 + 4 + 2 + 1 = 55)Common Binary Calculation Mistakes
1010 is not one thousand ten; it means 1(2³) + 0(2²) + 1(2¹) + 0(2⁰) = 10 in decimal.
The result of an unrestricted integer calculation is not necessarily the same as the result stored in a fixed-size 8-bit or 16-bit register.
11111101 is 253 unsigned, but represents −3 as signed eight-bit two's complement.
A wrapped register result can look perfectly valid unless the carry or overflow condition is examined.
Converting a large integer through an ordinary floating-point number can silently truncate its exact value beyond 53 bits.
Each hexadecimal digit corresponds directly to four binary bits, which makes hexadecimal a compact representation of binary data.
Practical Uses of a Binary Calculator
Binary calculations are commonly used in computer science, programming, digital electronics, embedded systems, networking, and low-level data processing.
A binary calculator is useful for checking binary arithmetic, bitwise operations, fixed-width integer behavior, bit shifts, signed and unsigned values, and conversions between number bases.