Skip to content

Bitwise Calculator

Compute AND, OR, XOR, NOT and bit shifts on two integers.

Calculated locally in your browser.

How do you calculate bitwise operations on two integers?

AND keeps bits set in both numbers, OR keeps bits set in either, XOR keeps bits set in exactly one, NOT inverts all bits, and shifts move bits left or right. Operations use 32-bit integers, matching JavaScript and many languages. For example, 12 AND 10 = 8, 12 OR 10 = 14, and 12 XOR 10 = 6.

Understanding your result

Operations use 32-bit integers, matching how JavaScript and many languages handle bitwise maths.

Formula and method

AND keeps bits set in both, OR keeps bits set in either, XOR keeps bits set in exactly one, NOT inverts all bits, and shifts move bits left or right.

Worked example

12 AND 10 = 8, 12 OR 10 = 14, 12 XOR 10 = 6.

How to use this tool

  1. Enter integer A (and optionally B).
  2. Read the result of each operation.

Common mistakes to avoid

  • Expecting unsigned results for NOT — ~12 is −13 in signed 32-bit.

About the Bitwise Calculator

Perform bitwise operations on two integers and see the result in decimal, binary and hexadecimal.

Who should use this tool

Programmers working with flags, masks and low-level logic.

Explore all Mathematics tools

Frequently asked questions

What is the difference between >> and >>>?

>> keeps the sign bit (arithmetic shift); >>> fills with zeros (logical shift).

What bit width is used?

32-bit signed integers, as in JavaScript.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: