Binary Calculator
Perform binary arithmetic (+, -, ×, ÷) with live conversions to decimal, hexadecimal, and octal with full bitwise logic.
All formulas and computation matrices for this calculator execute directly in your browser with zero latency. Enter your parameters to see instant results.
Who Uses This Calculation & Why Accuracy Matters
Computer systems architects, embedded firmware engineers, network administrators, computer science students, and cybersecurity analysts use this binary calculator to perform bitwise logic operations (AND, OR, XOR, NOT, Bit Shifts), binary arithmetic (addition, subtraction, multiplication, division), and radix conversions between base-2, base-8, base-10, and base-16.
A network engineer calculating network routing address by applying a bitwise AND between an IPv4 host address (192.168.1.135) and a /24 subnet mask (255.255.255.0).
An embedded systems programmer encoding a negative sensor temperature reading (-42°C) into an 8-bit signed register.
A security engineer encrypting an 8-bit plaintext character (01000001₂ = 'A') with a pseudo-random keystream byte (10110101₂).
Binary Radix Conversions & Bitwise Logic Truth Tables
Fundamental bitwise logical operators across binary inputs A and B.
| Bit A | Bit B | Bitwise AND (A & B) | Bitwise OR (A | B) | Bitwise XOR (A ^ B) | Bitwise NOT (~A) |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 |
* XOR outputs 1 if and only if exactly one input bit is 1 (parity detector).
Positional Binary Expansion & Two's Complement Equations
Binary numbers represent quantities in base-2 positional notation where bit weights double at each position. Negative integers use Two's Complement representation.
Discrete binary digit (0 or 1).
Weight of bit position i (1, 2, 4, 8, 16, 32, 64, 128...).
Inverts all 0s to 1s and 1s to 0s.
Step-by-Step Worked Examples with Real Numbers
Worked Example 1: Binary Addition with Carry Bits
Sum bit = 1.
Generates carry to 2².
Generates carry to 2³.
Generates carry to 2⁴.
Final Sum = 10001₂ (16 + 1 = 17 in decimal).
Worked Example 2: Converting -18 to 8-Bit Two's Complement
Positive 18.
Flipped bits.
11101110₂ represents -18 in two's complement.
Assumptions, Edge Cases & Common Calculation Mistakes
ℹ Underlying Algorithm Assumptions
- Assumes standard big-endian bit significance (MSB on the left, LSB on the right).
- Assumes fixed bit-width modes (8-bit byte, 16-bit word, 32-bit dword, 64-bit qword).
- Assumes two's complement signed encoding for negative numbers.
⚠ 3 Common Mistakes to Avoid
- Arithmetic overflow: Adding two positive numbers in 8-bit signed math exceeding +127 wraps to negative (e.g., 127 + 1 = -128).
- Confusing logical right shift (`>>>`, shifts in zeros) with arithmetic right shift (`>>`, preserves sign bit).
- Confusing bitwise operators (`&`, `|`) with boolean short-circuit logical operators (`&&`, `||`).