Skip to content
cosmodev ~/tools/bitwise

Bitwise कैलकुलेटर

Data & DevOps

8/16/32/64-bit values पर AND, OR, XOR, NOT, shifts और rotates को exact bigint गणित से निकालें। Operands को binary, octal, decimal या hex में दर्ज करें और हर base में परिणाम पढ़ें, साथ में live bit grid। 100% आपके browser में चलता है।

Operation

(Documentation in English)

What it does

The Bitwise Calculator performs exact, width-masked bit operations on 8 / 16 / 32 / 64-bit values. Enter operands in binary, octal, decimal or hex - each operand keeps its own base - and read the result in every base at once in the sticky result panel, which carries badges for the active operator and width (e.g. XOR · 8-bit) and a live bit grid highlighting exactly which bits are set. Supported operations: AND, OR, XOR, NOT (unary), SHL/SHR (logical shifts), and ROL/ROR (rotates that wrap within the chosen width). All math runs on bigint, so results are exact with no floating-point rounding. Everything stays in your browser.

Operator reference

Operator Symbol Inputs What it does
AND & A and B 1 where both operands have a 1 - masks and extracts bits
OR | A and B 1 where either operand has a 1 - sets and combines bits
XOR ^ A and B 1 where the operands differ - toggles bits
NOT ~ A only Flips every bit within the chosen width (operand B is ignored)
SHL << A, count B Shifts A left by B; zeros enter from the right, bits pushed past the width are masked away
SHR >> A, count B Logical shift right by B; zeros enter from the left
ROL ⟲ A, count B Rotates left by B mod width; bits leaving the top re-enter at the bottom
ROR ⟳ A, count B Rotates right by B mod width; bits leaving the bottom re-enter at the top

How to use it

  1. The tool opens on a live sample - XOR of hex CA and 35 at 8-bit - so there is a computed result from the first paint. Edit either operand and the panel updates instantly.
  2. Pick a width (8/16/32/64-bit) from the toolbar - this masks every value and result.
  3. Choose an operation from the operator row (AND through ROR). Selecting NOT disables operand B.
  4. Type Operand A (and Operand B for binary ops; for shifts and rotates B is the count). The BIN/OCT/DEC/HEX switch above each operand sets its base - prefixes like 0x / 0b / 0o are stripped automatically.
  5. Read the result panel: Decimal, Hex, Octal and Binary lines plus the bit grid (MSB left, LSB right, highlighted bits are set). Copy result copies all four lines; Copy share link encodes the whole calculation in the URL.
  6. Sample restores the built-in example; Clear empties both operands.

Examples

Every value below is the tool’s real output for the given input.

XOR two hex bytes (8-bit) - the default sample

width: 8-bit   op: XOR
A (hex): CA  → 1100 1010
B (hex): 35  → 0011 0101
result: dec 255 · hex 0xff · oct 0o377 · bin 1111 1111  (every bit set)

Mask with AND (32-bit)

A (hex): DEADBEEF   B (hex): 0000FFFF
result: dec 48879 · hex 0x0000beef · bin 0000 0000 0000 0000 1011 1110 1110 1111

NOT and shifts (8-bit)

op: NOT   A (hex): 0F, B: -        → dec 240 · hex 0xf0 · bin 1111 0000
op: SHL   A (hex): 01, B (dec): 4  → dec 16  · hex 0x10 · bin 0001 0000
op: SHR   A (hex): 08, B (dec): 1  → dec 4   · hex 0x04 · bin 0000 0100

Rotates wrap within the width (8-bit)

op: ROL   A (hex): 80, B (dec): 1  → dec 1   · hex 0x01 · bin 0000 0001
  (1000 0000 rotated left by 1: the top bit wraps around to bit 0)
op: ROR   A (hex): 01, B (dec): 1  → dec 128 · hex 0x80 · bin 1000 0000
  (0000 0001 rotated right by 1: bit 0 wraps around to the top)

Negative operands are normalized (8-bit)

A (dec): -1   op: AND   B (dec): 1
result: dec 1 · hex 0x01 · bin 0000 0001
  (-1 becomes 1111 1111, the 8-bit two's-complement pattern, before the op)

Good to know

  • Two’s-complement masking: every value is normalized to the unsigned width-bit pattern before the op, and the result is masked back - so NOT 0x0F in 8-bit is 0xf0, never a giant negative number, and -1 in 8-bit behaves as 0xff.
  • Shifts drop the overflow: 0xFF << 1 in 8-bit is 0xfe - the bit pushed past the width is gone, exactly like native fixed-width integers.
  • Rotates wrap: ROL/ROR rotate by count mod width, so a rotate by the width itself is a no-op.
  • Shareable: operands, bases, op and width are all encoded in the URL - open the link and the exact calculation is restored.
  • Private: all calculation is local - nothing is sent anywhere.
  • Related tools: Number Base Converter, JSON Formatter, Cron Expression Explainer.
सोर्स कोड14 languages

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.