
Bitwise Calculator
Perform AND, OR, XOR, NOT, shift operations. Enter decimal, hex, or binary. Click bits to toggle them.
Last reviewed: June 2026New to this tool? Click here for instructions
Input A - click bits to toggle
Input B - click bits to toggle
Result bits
How to Use the Bitwise Calculator
The Bitwise Calculator is a free online tool that allows you to perform various bitwise operations. To use the tool, follow these steps:
1. Select the bit width (8-bit, 16-bit, or 32-bit) at the top of the calculator.
2. Enter your values in decimal, hexadecimal, or binary format in the input grids.
3. Choose the operation you want to perform (AND, OR, XOR, NOT, Left Shift, or Right Shift).
4. Click the bits in the input grids to toggle them and see how the result changes instantly.
5. The results will be displayed in decimal, hexadecimal, and binary formats simultaneously.
When to Use the Bitwise Calculator
The Bitwise Calculator is particularly useful for developers and programmers who need to work with low-level data manipulation. It can help you understand and debug bitwise operations in your code. Whether you're working on network programming, game development, embedded systems, or cryptography, this tool can simplify complex operations and make your code more efficient.
How It Works
The Bitwise Calculator runs in your browser with JavaScript. It parses decimal, hexadecimal, and binary input locally, applies the selected bit width as a mask, performs the operation with JavaScript bitwise operators, and renders the decimal, hexadecimal, binary, and clickable bit-grid views immediately. Your entered values are not uploaded to a backend service.
Tips, Edge Cases, and Limitations
Here are some tips and considerations when using the Bitwise Calculator:
1. JavaScript bitwise operators work on 32-bit integer values, so this tool masks results to the selected 8-bit, 16-bit, or 32-bit view.
2. Use hexadecimal or binary input when you need to inspect flags, masks, permissions, protocol bytes, or register-style values without mental base conversion.
3. For NOT operations, remember that the result depends on the selected width: NOT 0 is 255 in 8-bit mode, 65535 in 16-bit mode, and 4294967295 in 32-bit unsigned display.
4. Shift operations discard bits that move past the selected width. Check the bit grid when debugging overflow, sign-extension assumptions, or protocol field boundaries.
5. For arbitrary-precision bitwise work beyond 32 bits, use a language or library with explicit BigInt-style operations.
Sources and further reading
For JavaScript operator behavior, see MDN's reference for bitwise AND and the linked bitwise operator pages. For the language-level production, see the ECMAScript specification linked from that MDN reference.
Frequently Asked Questions
Quick reference
| Operation | Binary A | Binary B | Result |
|---|---|---|---|
| AND | 1010 | 1100 | 1000 |
| OR | 1010 | 1100 | 1110 |
| XOR | 1010 | 1100 | 0110 |
| NOT | 1010 | - | 0101 |
| Shift Left | 1010 | 1 | 10100 |
| Shift Right | 1010 | 1 | 101 |
Example walk-through
Worked example: step-by step
Step 1. Navigate to the Bitwise Calculator webpage and locate the input fields for binary numbers.
Step 2. Enter two binary numbers (e.g., 1010 and 1100) into the respective input fields.
Step 3. Select the desired bitwise operation (e.g., AND, OR, XOR) from the dropdown menu. The calculator will process the input using the selected operation.
Step 4. View the result displayed in decimal and binary formats. For the sample input, the AND operation would produce 1000 (8 in decimal).
Sample input:
Binary 1: 1010
Binary 2: 1100
Operation: AND
Expected output:
Decimal: 8
Binary: 1000