# Bitwise Calculator - AND, OR, XOR, Shifts and Two's Complement

> Free online bitwise calculator: AND, OR, XOR, NOT, shifts and rotates at 8, 16, 32 or 64 bits, with two's complement reading, clickable bits, hex and decimal.

- URL: https://qilingtools.com/en/bitwise
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Developer](https://qilingtools.com/en/tags/dev), [Encoding](https://qilingtools.com/en/tags/encode), [Algorithms](https://qilingtools.com/en/tags/algorithm)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

When you are poking at a register, decoding protocol flags or working out a permission mask, the slow part is not the arithmetic — it is converting between binary, hex and decimal and keeping track of which bit is which. This calculator shows AND, OR, XOR, NAND, clear, complement, both right shifts and the rotates all at once, each result printed as padded binary, hex and decimal. Pick a width of 8, 16, 32 or 64 bits and click the bit cells to flip them. Everything is computed with big integers, so 64-bit results are right where JavaScript's own operators would overflow.

## How to use

1. Type values A and B — decimal, or 0x1F, 0b1010 and 0o17 all work
2. Pick the width, and tick signed if you want to read negatives
3. Set the shift amount; every result updates as you type
4. Click the bit cells to flip individual bits of A when building a mask

## Features

- Twelve operations at once: AND, OR, XOR, NAND, AND NOT, NOT, left shift, logical and arithmetic right shift, rotate left and right
- Every result in grouped binary, hex and decimal, each one copyable
- Clickable bit grid so you can see exactly which bit changed
- Also reports the population count, highest and lowest set bit and whether the value is a power of two

## FAQ

### Why does this differ from my browser console?

JavaScript converts operands to 32-bit signed integers, so anything wider overflows, and >>> turns negative numbers into very large positive ones. This page uses BigInt truncated to the width you chose, so 64-bit and signed results come out correct.

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

Logical shift (>>>) always fills with zeros, which treats the value as an unsigned bit string. Arithmetic shift (>>) fills with the sign bit, so a negative number stays negative — it behaves like a signed division by 2ⁿ.

### How do I test whether a bit is set?

AND it with a mask: to check bit 3, AND with 1 << 3 = 0b1000 and see if the result is non-zero. OR sets a bit, AND NOT clears it and XOR flips it — all four are listed here already.

### How should I read two's complement?

The top bit is the sign and a negative value is the complement plus one. In 8 bits 0xFF is both unsigned 255 and signed −1: one bit pattern, two readings. Tick the signed box to see both side by side.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
