Skip to content
M2TOOLKIT

Bitwise Calculator

Work through bit operations with every representation side by side.

  • Free
  • No sign-up
  • Nothing is sent or stored
Width
A
00000000000000000000000011001010
202 · 0x000000CA
B
00000000000000000000000000001111
15 · 0x0000000F
OperationDecimalHexBinary
A AND B (a & b)100x0000000A0000 0000 0000 0000 0000 0000 0000 1010
A OR B (a | b)2070x000000CF0000 0000 0000 0000 0000 0000 1100 1111
A XOR B (a ^ b)1970x000000C50000 0000 0000 0000 0000 0000 1100 0101
NOT A (~a)-2030xFFFFFF351111 1111 1111 1111 1111 1111 0011 0101
A << 2 (a << 2)8080x000003280000 0000 0000 0000 0000 0011 0010 1000
A >> 2 (arithmetic) (a >> 2)500x000000320000 0000 0000 0000 0000 0000 0011 0010
A >>> 2 (logical) (a >>> 2)500x000000320000 0000 0000 0000 0000 0000 0011 0010
A AND NOT B (clear bits) (a & ~b)1920x000000C00000 0000 0000 0000 0000 0000 1100 0000

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved.

How to use the Bitwise Calculator

  1. Enter A and B in decimal, 0x hex, 0b binary or 0o octal.
  2. Choose the bit width and signed or unsigned.
  3. Read every operation's result in decimal, hex and binary.

What does this tool do?

Bitwise operations are everywhere in low-level code: flags and masks, permissions, colour packing, hashing and network calculations. Results wrap to the chosen width using two's complement, exactly like fixed-size integers in C, Java or Go. 64-bit maths uses BigInt, so nothing is rounded.

Why use it?

  • 8 to 64-bit.
  • Signed or unsigned.
  • Visual bit grid.

The formula

Arithmetic shift >> keeps the sign bit
Logical shift >>> fills with zeros
NOT a = −a − 1 (two's complement)

Privacy

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the bitwise calculator.