Skip to content
epitometool

Bitwise calculator

Calculators

Evaluate AND, OR, XOR, NOT, and shift operations at 8/16/32/64-bit width, with results in decimal, hex, binary, and octal.

Updated

Operands

Accepts decimal, 0x hex, 0b binary, and 0o octal.

Result

Decimal

8

Hex

0x00000008

Binary

0000 0000 0000 0000 0000 0000 0000 1000

Octal

0o10

Quick start

How to use the bitwise calculator

Enter operands, pick an operation and width, read the result — all local.

  1. Step 1
    Enter values

    Type operands in decimal, 0x hex, 0b binary, or 0o octal.

  2. Step 2
    Pick operation and width

    Choose AND/OR/XOR/NOT/shift and a bit width of 8, 16, 32, or 64.

  3. Step 3
    Read and copy

    See the result in decimal, hex, binary, and octal and copy any form.

In-depth guide

Bitwise operations: AND, OR, XOR, NOT, and shifts

Bitwise operations work on the individual bits of an integer rather than its numeric value. They power flags, masks, permissions, colour channels, and low-level protocols. This calculator evaluates AND, OR, XOR, NOT, and shifts on values you enter in any base, at a bit width you choose, and shows the result in decimal, hex, binary, and octal — all in your browser using exact BigInt maths.

What each operation does

  • AND (&) — a bit is 1 only if both inputs have 1 there. Used to mask bits.
  • OR (|) — a bit is 1 if either input has 1. Used to set flags.
  • XOR (^) — a bit is 1 if the inputs differ. Used to toggle bits.
  • NOT (~) — flips every bit within the bit width.
  • Shifts (« ») — slide bits left or right; left by n multiplies by 2ⁿ, right divides.

Where bitwise maths shows up

  • Feature flags / bitfields — pack many booleans into one integer with OR and test with AND.
  • Permissions — Unix file modes are bitfields (read=4, write=2, execute=1).
  • Colours — extract R, G, B channels from a packed 0xRRGGBB value with shifts and masks.
  • Hardware / protocols — set or read individual control-register bits.

Step by step

  1. Enter value A in decimal, 0x hex, 0b binary, or 0o octal.
  2. Pick an operation; for shifts the second field becomes the shift amount, and NOT hides it entirely.
  3. Choose the bit width (8 / 16 / 32 / 64) that matches your data type.
  4. Read the result in all four bases and copy whichever you need.

Common pitfalls

  • NOT depends on width. ~0 is 0xFF at 8-bit but 0xFFFFFFFF at 32-bit. Always set the width first.
  • JavaScript's own operators are 32-bit and signed. This tool uses BigInt to stay exact at 64-bit, unlike a quick a & b in the console.
  • Shifts wrap the amount. Shifting by more than the width clears the value in most languages; keep the shift amount below the bit width.

Privacy and how it runs

Every calculation happens in your browser with BigInt arithmetic — no network requests, no logging, no eval. The page works offline after loading and keeps nothing once you close the tab.

When to use it vs alternatives

Use this calculator for quick everyday estimates, date math, percentages, bill splitting, or simple planning. Use an official source or domain-specific calculator when legal, billing, payroll, or compliance accuracy is required.

Frequently asked questions

Which bitwise operations does this calculator support?

AND (&), OR (|), XOR (^), NOT (~), left shift («) and right shift (»). NOT is unary so it ignores the second operand; the shift operations treat the second value as the number of positions to shift.

What input formats can I use?

Decimal, hexadecimal with a 0x prefix, binary with 0b, and octal with 0o — for example 12, 0xC, 0b1100, and 0o14 all represent the same value. You can mix formats between the two operands.

Why do I need to pick a bit width?

NOT and the binary/hex views depend on how many bits represent the number. At 8-bit, NOT 0 is 255 (0xFF); at 32-bit it is 4294967295. The width also controls zero-padding in the binary output, so choose the width of the integer type you are modelling (uint8, uint16, uint32, uint64).

Are results signed or unsigned?

Results are shown unsigned within the chosen bit width — every value is masked to that width so the binary and hex representations are unambiguous. If you need a two's-complement signed interpretation, read the binary and apply the sign bit yourself.

Does it handle 64-bit numbers accurately?

Yes. The calculator uses JavaScript BigInt rather than the 32-bit integers that normal JS bitwise operators are limited to, so 64-bit AND/OR/XOR/shift results are exact with no precision loss.

Is anything sent to a server?

No. All arithmetic runs in your browser with BigInt and there is no eval anywhere in the code. Nothing is uploaded or stored — the tool works fully offline once loaded.

Keep exploring

More tools you'll like

Hand-picked utilities that pair well with the one you're on — all free, client-side, and zero-signup.