← Back to all tools

🔢 Binary Calculator

Perform binary arithmetic and conversions

Result
Decimal
Hexadecimal
Octal

About Binary Calculator

Perform binary arithmetic operations including addition, subtraction, multiplication, division, AND, OR, and XOR. See results in binary, decimal, hexadecimal, and octal. This tool runs entirely in your browser.

How to Use Binary Calculator

  1. Enter the first binary number (e.g., 1010)
  2. Select the operation: AND, OR, XOR, NOT, shift, add, or subtract
  3. Enter the second binary number
  4. View the result in binary, decimal, and hexadecimal
  5. Use the step-by-step breakdown to understand the operation

About Binary Calculator

Binary arithmetic and bitwise operations are fundamental to computer science and low-level programming. Every CPU performs billions of binary operations per second — addition, subtraction, and logical operations (AND, OR, XOR, NOT) on binary numbers. Understanding these operations is essential for tasks like network subnet calculations, hardware register manipulation, graphics programming, encryption algorithms, and embedded systems development. Bitwise AND is used for masking specific bits, OR for setting bits, XOR for toggling bits and simple encryption, and shift operations for efficient multiplication/division by powers of 2. This calculator shows results in binary, decimal, and hex simultaneously, making it invaluable for debugging and learning.

Frequently Asked Questions

What is bitwise AND used for?

AND masks specific bits — if both bits are 1, the result is 1. Common uses: extracting specific bits from a value (bit masking), checking if a flag is set, and IP subnet calculations where you AND an IP with a subnet mask.

How does XOR work?

XOR returns 1 when bits are different, 0 when they're the same. It's used for toggling bits, simple encryption (XOR cipher), swap algorithms without temp variables, and error detection (parity checking).

What are shift operations?

Left shift (<<) moves bits left, effectively multiplying by 2 for each position. Right shift (>>) divides by 2. These are faster than multiplication/division in hardware and are used extensively in performance-critical code.

Why do programmers use hexadecimal?

Hex is a compact way to represent binary — each hex digit maps to exactly 4 bits. 0xFF in hex equals 11111111 in binary equals 255 in decimal. It's much easier to read than long binary strings.

What's two's complement?

Two's complement is how computers represent negative numbers in binary. The leftmost bit indicates sign (0=positive, 1=negative). To negate a number: flip all bits and add 1. This allows addition hardware to handle subtraction too.

Related Tools

Number Base Converter → Binary ↔ Text Converter → Hex to RGB Converter → Bitwise Calculator →