Bitwise Calculator
Perform AND, OR, and XOR bitwise operations with step-by-step explanations
Bitwise Calculator
Number of bits for calculation and result representation
Enter first decimal number
Enter second decimal number
Bitwise AND: Result is 1 only when both bits are 1
Example Bitwise Operations
AND Operation
Result is 1 only when both bits are 1
OR Operation
Result is 1 when at least one bit is 1
XOR Operation
Result is 1 when exactly one bit is 1
Bitwise Truth Tables
AND (&)
A | B | A & B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
OR (|)
A | B | A | B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
XOR (^)
A | B | A ^ B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Number Systems
Binary (Base 2)
Uses digits 0 and 1
Example: 1101₂ = 13₁₀
Decimal (Base 10)
Uses digits 0-9
Example: 87₁₀ = 1010111₂
Octal (Base 8)
Uses digits 0-7
Example: 127₈ = 87₁₀
Bitwise Tips
AND is useful for masking bits
OR is useful for setting bits
XOR is useful for toggling bits
XOR with itself equals zero
Understanding Bitwise Operations
What are Bits?
A bit is the smallest unit of information in computing, representing a logical state with two possible values: 0 or 1. Bits are combined to form larger data structures, with 8 bits making one byte. Understanding bitwise operations is fundamental in computer science.
Applications:
- • Data compression and encryption
- • Network programming and IP masking
- • Graphics and image processing
- • Embedded systems programming
- • Database indexing and optimization
Bitwise vs Logical Operations
Bitwise Operations
Operate on individual bits of numbers. Each bit position is processed independently according to the truth table of the operation.
Number Representation
Numbers can be represented in different bases (binary, decimal, octal, hexadecimal). Our calculator supports binary, decimal, and octal inputs for flexibility.
Two's Complement
Negative numbers are represented using two's complement notation, which allows consistent bitwise operations across positive and negative integers.