Binary Arithmetic & Bitwise Calculator
Compute binary addition, subtraction, multiplication, and bitwise gates (AND, OR, XOR, NOT) with instant multi-base conversions.
Complete Guide to Binary Arithmetic, Bitwise Logic Gates & Radix Conversion
The binary numeral system (base-2) utilizes only two discrete symbols: 0 (LOW / False) and 1 (HIGH / True). Modern digital computing, microprocessors (ALU), network subnetting (IPv4/IPv6), and cryptographic hashing algorithms (SHA-256) operate entirely on binary arithmetic and bitwise Boolean logic operations.
Binary Arithmetic Rules
- • Addition: 0+0=0, 0+1=1, 1+1=10₂ (0 carry 1), 1+1+1=11₂
- • Subtraction: 0-0=0, 1-0=1, 1-1=0, 0-1=1₂ (borrow 1)
- • Multiplication: 0×0=0, 0×1=0, 1×1=1
- • Two's Complement: Invert bits (~x) and add 1 for negatives
Bitwise Logic Gates Summary
Bitwise operators manipulate individual bit positions in parallel:
AND (&): 1 only if BOTH bits are 1 (Bitmasking)
OR (|): 1 if AT LEAST ONE bit is 1 (Setting flags)
XOR (^): 1 if bits DIFFER (Toggling & encryption)
NOT (~): Inverts every bit (1 → 0, 0 → 1)
Boolean Bitwise Logic Gates Master Truth Table
| Input A | Input B | AND (A & B) | OR (A | B) | XOR (A ^ B) | NAND | NOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Frequently Asked Questions (FAQ)
Why is XOR used so extensively in computer cryptography and hashing?
XOR is a reversible operation with perfect information symmetry: (A ^ B) ^ B = A. This property allows simple encryption and decryption keys (such as one-time pads) without data loss or computational overhead.
How many bits are in a byte and a nibble?
1 Byte = 8 bits (representing numbers from 0 to 255 unsigned, or 0x00 to 0xFF in hexadecimal). 1 Nibble = 4 bits (which corresponds to exactly one hexadecimal digit).
What is bit shifting (left shift << and right shift >>)?
Left shifting bits by 1 position (x << 1) is equivalent to multiplying the integer by 2. Right shifting by 1 position (x >> 1) performs integer division by 2.