Number & Math

Bitwise Calculator

AND, OR, XOR, NOT and shifts - results shown in bin / oct / dec / hex.

Width

Operands

Operation

Result (decimal)

15

Result (hex)

0xF

Result (binary)

0000 0000 0000 0000 0000 0000 0000 1111

About this tool

Enter two operands (or one for NOT), pick an operation, and see the result in every common base. Useful when reverse-engineering bit flags, debugging C / Rust code, or working with permissions bitmasks. Toggle between 32-bit (JS native) and 64-bit (BigInt) modes.

FAQs

Are results 32-bit or 64-bit?

Defaults to 32-bit signed - matches what JavaScript bitwise operators do natively. Toggle 64-bit mode for permission masks, file modes, or other wide bit fields where the high bits matter.

What is two's complement?

The standard way computers encode negative integers: flip the bits and add one. -1 in 8-bit two's complement is 11111111. Most CPUs (and JS bitwise ops) use it implicitly.

Why use XOR?

XOR is its own inverse - a XOR b XOR b = a. Useful for in-place swaps, simple stream ciphers, toggling bit flags, and parity / checksum bytes.

Difference between >> and >>>?

JavaScript's >> is sign-preserving (arithmetic shift) - -1 >> 1 = -1. >>> shifts zeros in from the left (logical shift) and always returns a non-negative number. C and Rust call these `>>` on signed vs unsigned types.

Can I do rotations (ROL / ROR)?

Yes - the tool has rotate-left and rotate-right operations alongside shifts. Specify the width (32 or 64) and rotation amount; the wrap-around bits come from the other end.

Other tools