Skip to content
M2TOOLKIT

Developer · free tool

Bitwise Calculator

Work through bit operations with every representation side by side.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Developer
  • Free
  • No sign-up
  • Nothing is sent or stored
  • Updated
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.

Use cases

  • Work with flags, masks and permissions.
  • Check overflow at fixed integer sizes.
  • Learn binary maths for exams and interviews.

A = 12 (1100), B = 10 (1010), 8-bit

Each operation works bit by bit:

OperationBinaryDecimal
A AND B10008
A OR B111014
A XOR B01106
NOT A (unsigned)11110011243 (−13 signed)
A << 11100024

Common mistakes

  • Forgetting that NOT depends on the bit width.
  • Using arithmetic right shift when you meant logical (or the other way round).
  • Mixing signed and unsigned interpretations of the same bits.

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.

Frequently asked questions

What is two's complement?

The usual way to store negative integers: invert the bits and add one.

Can I enter hex or binary?

Yes, use 0x for hex, 0b for binary and 0o for octal.

Are 64-bit results exact?

Yes, they use BigInt, so nothing is rounded.

Content last updated . See how M2Toolkit works.

Other tools people use alongside the bitwise calculator.