A friendly bit manipulator to help you develop better intuition for bits, bytes, and bitwise operations.

**What the heck are bits?**

Bits are the smallest units of information in computers. They can have only two values: 0 or 1, off or on. Bits are used to represent data in computers and to perform logical operations.

**What the heck is a byte?**

A byte is a unit of digital information consisting of 8 bits. A byte can assume 256 (2^{8}) distinct states of 0's and 1's. In our case, a byte is used to represent non-negative integers from 0-255.

**What the heck are bitwise operations?**

Bitwise operations are operations that manipulate the bits of a number. There are four bitwise operators: `AND`

, `OR`

, `XOR`

, and `NOT`

. These operators allow you to combine, modify, or extract specific bits from a number.

**What the heck is the AND operator?**

The `AND`

operator returns 1 if both input bits are 1, otherwise it returns 0. This operator is commonly used to mask out specific bits from a number or to test if a specific bit is set.

**What the heck is the OR operator?**

The `OR`

operator returns 1 if at least one input bit is 1, otherwise it returns 0. This operator is commonly used to set specific bits in a number or to combine multiple values into a single value.

**What in holy hell is the XOR operator?**

The `XOR`

operator (eXclusive OR) returns 1 if the input bits are different, otherwise it returns 0. This operator is commonly used to toggle specific bits in a number or to compare two values for equality.

**What the heck is the NOT operator, and why isn't it included here?**

The `NOT`

operator, also known as the bitwise complement, returns the inverse of the input bit. It returns 0 if the input bit is 1, and 1 if the input bit is 0. This operator is commonly used to invert specific bits in a number. It's not included here because it's a unary operation (i.e., it has only one operand), whereas the operations being demonstrated here are binary operations (i.e., they involve two operands).

**What the heck is bit shifting?**

Bit shifting is a bitwise operation that moves the bits of a number to the left or right. When you shift a bit to the left, you double its value. When you shift a bit to the right, you halve its value. Hey, that's pretty cool! Bit shifting is commonly used to perform fast multiplication or division by powers of two.

**How the heck do I use this app to learn about bitwise operations?**

Easy! Click the buttons of either of the input bytes to toggle its bits on or off, and the result will be reflected in the binary and integer equivalents to the right. You can also use the shift left and shift right buttons to shift the bits to get a sense for how that works. The `AND`

, `OR`

, and `XOR`

radio buttons specify which logical operation to perform on the two input bits, and the output byte will instantaneously reflect the result. Play around with different combinations of bits and logical operators to see how they behave!