DevGizmo

Bitwise Calculator

Perform AND, OR, XOR, NOT, left shift and right shift operations on integers, with results in decimal, binary, hex and octal.

About the Bitwise Calculator

The DevGizmo Bitwise Calculator lets you apply any of the six fundamental bitwise operations to decimal integer operands. Enter your values, select the operation and bit width, and the result is shown immediately in decimal, binary, hexadecimal and octal — with a human-readable expression summary so you can see exactly what was computed.

The calculator supports 8-bit, 16-bit and 32-bit unsigned integer modes. The bit width determines both the valid input range and how the result is masked. All operations are performed in your browser with no server round-trips.

Supported Operations

  • AND (&) — sets a bit to 1 only where both operands have a 1. Used to mask or test specific bits.
  • OR (|) — sets a bit to 1 where either operand has a 1. Used to set specific bits.
  • XOR (^) — sets a bit to 1 where exactly one operand has a 1. Used to toggle bits or detect differences.
  • NOT (~) — inverts all bits of the operand. The result is masked to the selected bit width so the output remains unsigned.
  • Left Shift (<<) — shifts bits left by the specified amount, equivalent to multiplying by a power of two. Bits shifted beyond the width are discarded.
  • Right Shift (>>) — shifts bits right by the specified amount, equivalent to integer division by a power of two. Vacated high bits are filled with zeros.

Common Use Cases

Embedded systems developers use bitwise operations constantly — testing whether a flag is set with AND, enabling a peripheral with OR, toggling a pin state with XOR, and reading nibbles with shifts. Software developers use them for permission flags, bitmasks in network protocols, hash functions, and performance-critical arithmetic. The calculator is also useful as a learning tool when studying computer architecture or preparing for technical interviews.

Bit Width and Unsigned Mode

JavaScript uses 32-bit signed integers internally for bitwise operations, which can produce unexpected negative results when working in full 32-bit mode. This calculator always returns unsigned results by masking to the selected bit width, matching the behaviour of C/C++ uint8_t, uint16_t and uint32_t types.