Bitwise Calculator
Run any bitwise operation on integers at the width you choose, then read both operands and the result across binary, hex, octal and decimal at once. Enter values in decimal or with a 0x, 0o or 0b prefix, and negatives are wrapped into the width with twos complement. Because it runs on BigInt, results stay exact all the way up to full 64-bit values, which native JavaScript operators cannot manage.
How to use the bitwise calculator
- Choose a bit width from the 'Bit width' menu: 8, 16, 32 or 64 bits.
- Pick an operation from the 'Operation' menu, such as AND, XOR or Left shift.
- Type 'Value A' in decimal, or with a 0x, 0o or 0b prefix for hex, octal or binary.
- Enter 'Value B', or the 'Shift amount' when you pick a shift; NOT hides this box because it takes one operand.
- Read the Value A, Value B and Result cards, each showing binary, hex, decimal, signed and octal, and copy any row you need.
Examples
AND two bytes (masking)
0xF0 AND 0x0F, 8 bits
0x00, binary 0000 0000, decimal 0
NOT a byte (twos complement)
NOT 0x0F, 8 bits
0xF0, binary 1111 0000, decimal 240, signed -16
Left shift by 4
1 SHL 4, 8 bits
0x10, binary 0001 0000, decimal 16
Frequently asked questions
Which bitwise operations are supported?
AND, OR, XOR, NOT, NAND, NOR and XNOR, plus logical left shift (SHL) and right shift (SHR). NOT takes a single operand, and the two shifts take a value plus a shift amount, while the rest combine two values.
What number formats can I enter?
Decimal by default, or a 0x prefix for hex, 0o for octal and 0b for binary. Underscores and spaces are allowed inside a number as digit separators, so 0b1111_0000 and 1 000 both parse fine.
Does it really support 64-bit values?
Yes. Every calculation runs on BigInt rather than the 32-bit signed integers that JavaScript bitwise operators use, so 8, 16, 32 and 64 bit widths are all exact, including the full unsigned 64-bit range up to 18446744073709551615.
How are negative numbers handled?
A negative decimal is wrapped into the chosen width using twos complement, so -1 at 8 bits becomes 11111111 and -16 becomes 11110000. Each card shows both the unsigned decimal and the signed decimal reading of the same bit pattern.
Is the right shift arithmetic or logical?
Logical. Operands are treated as unsigned inside the width, so a right shift always feeds zeros into the top bits rather than copying a sign bit. Shifting by the width or more clears every bit and gives zero.
What do the binary, hex and octal outputs look like?
Binary is zero-padded to the full width and grouped in nibbles of four, like 1111 0000. Hex is uppercase with a 0x prefix and padded to the width, and octal carries a 0o prefix, so an 8-bit 240 reads as 0xF0 and 0o360.
What if I enter an invalid value or forget an operand?
A value that is not a recognised number shows an 'Invalid number' error. Leaving the second box empty for a two-operand op asks you to 'Enter the second value', and an empty shift box asks for a shift amount.
Is my data sent anywhere?
No. Everything runs in your browser, so the values you type never leave your device. That makes it safe for reverse-engineering flags or register masks from private firmware.
How is this different from a base converter?
A base converter just re-encodes one number across bases. This tool also applies a logic operation or shift between operands at a fixed width and shows the masked result, which is what you need when working with flags, permission bits and hardware registers.
Learn more
- Bitwise operations explained with byte examples
How AND, OR, XOR, NOT and shifts work bit by bit, why width and twos complement matter, and how to use masks to set, clear and test bits.
Related tools
Twos Complement Calculator
Convert a signed integer to its twos complement binary and hex for any bit width. Also decodes a twos complement bit pattern back to a signed value.
Number Base Converter
Convert numbers between any base from 2 to 36, including binary, octal, decimal and hex. Handles huge numbers exactly with arbitrary precision. Free, private.
Chmod Calculator
Convert Unix file permissions between octal (755), symbolic (rwxr-xr-x) and a checkbox grid. Get the chmod command instantly, all in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
ASCII Table
Full ASCII table for all 128 codes with decimal, hex, octal and binary values, character names and descriptions. Search by code, hex or character.
Aspect Ratio Box Generator
Generate CSS for a responsive aspect-ratio container. Use the modern aspect-ratio property or the padding-top fallback, then copy the ready code.