Skip to content

Bitwise Calculator

AND, OR, XOR, shifts and rotates, at 8 to 64 bits, shown in binary.

Width

Quick Tool Overview

The Bitwise Calculator works at up to 64 bits using arbitrary-precision integers, so a 64-bit mask behaves like one — unlike JavaScript’s own operators, which coerce to a signed 32-bit integer and quietly give the wrong answer.

What it does
Calculates bitwise operations and shows the bits
You give it
Two numbers in any base, and a width
You get back
The result in every base, with the bits aligned
Best for
Flags, masks, protocols and embedded work
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the Bitwise Calculator

Every bitwise operation, with the operands and the result laid out in binary so you can see which bits moved. Enter numbers in any base — hex, binary, octal or decimal — and choose a width from 8 to 64 bits.

The 64-bit support is the part that matters. JavaScript coerces both operands to a signed 32-bit integer before applying any bitwise operator, so `1 << 40` evaluates to 256 rather than a trillion, and `0xFFFFFFFF | 0` is −1. This calculator uses arbitrary-precision integers throughout, so a 64-bit mask behaves like a 64-bit mask. It also distinguishes the two right shifts properly: the arithmetic one copies the sign bit in, the logical one brings in zeros.

Key features of the Bitwise Calculator

Genuine 64-bit

1 << 40 gives a trillion, not 256. Every operation runs on BigInt, so nothing is silently truncated to 32 bits.

Both right shifts

Arithmetic copies the sign bit in; logical brings in zeros. The difference only shows on negative numbers, and it shows badly.

Twelve operations

AND, OR, XOR, NAND, NOR, XNOR, NOT, two shifts, a logical shift and both rotates.

Bits aligned in columns

Both operands and the result stacked, so you can read which bit came from where.

Any input base

Prefix with 0x, 0b or 0o, or write decimal — the base is detected from what you type.

How to use the Bitwise Calculator

  1. 1

    Enter two operands

    Decimal, or prefixed 0x, 0b or 0o — the base is detected.

  2. 2

    Choose a width

    8, 16, 32 or 64 bits; the result wraps to that width.

  3. 3

    Pick an operation

    AND, OR, XOR, NAND, NOR, XNOR, NOT, three shifts and two rotates.

  4. 4

    Read the bits

    Both operands and the result in binary, aligned so the columns line up.

Frequently asked questions

Because the operands are coerced to signed 32-bit integers first, so the shift count is taken modulo 32 — 40 becomes 8, and 1 << 8 is 256. Use BigInt, as this calculator does, and you get the trillion you expected.

Reviews of the Bitwise Calculator

What people who use the Bitwise Calculator think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Bitwise Calculator. It takes half a minute and no account.

Write the first review

More developer tools