Bitwise Calculator
Result
What is Bitwise Calculator
A bitwise calculator applies logical operations to the individual bits of two integers: AND, OR, XOR, NOT, left shift and right shift. You can type each operand in decimal, hexadecimal, binary or octal, and the result appears in all four bases at once. Every operation runs on 32-bit signed integers, the same behaviour you get from these operators in C, Java, Go and most other languages.
How to use
- Enter the first operand and pick its base (decimal, hex, binary or octal).
- Choose an operation: AND, OR, XOR, NOT, left shift or right shift.
- Enter the second operand and its base (skipped automatically for NOT, which uses only operand A).
- Read the result in decimal, hex, octal and 32-bit binary, then copy any representation you need.
When to use it
Working with a feature-flags integer and need to know if a specific bit is set? Say the value is 12 and you want to check flag bit 3 (worth 8). Enter 12, pick AND, enter 8, and the result 8 confirms the flag is on. The same masking trick lets you set bits with OR, toggle them with XOR, or clear a byte with a shift, all while seeing the binary pattern change as you type.
Frequently asked questions
What is a bitwise operation?
A bitwise operation compares two numbers bit by bit rather than as whole values. AND returns 1 only where both bits are 1, OR returns 1 where either is 1, and XOR returns 1 where the bits differ. Shifts slide the bits left or right. These operations are the foundation of flags, masks, permissions and low-level performance tricks.
How does the NOT operation work?
NOT is unary, so it uses only operand A and ignores operand B. It flips every one of the 32 bits, turning each 0 into a 1 and each 1 into a 0. Because of two's complement, NOT of a number x always equals -(x + 1). For example, NOT 5 is -6.
Why is my result a negative number?
The calculator uses 32-bit signed integers, so when the highest bit ends up set the value reads as negative in decimal. The binary, octal and hex fields still show the true 32-bit bit pattern, so NOT 5 shows -6 in decimal but 11111111111111111111111111111010 in binary.
Does right shift keep the sign?
Yes. This tool uses an arithmetic right shift, which copies the sign bit as it shifts. So 16 right-shifted by 2 gives 4, and -8 right-shifted by 1 gives -4. Shift amounts are taken modulo 32, matching how native shift operators behave.
Can I share this tool with my inputs pre-filled?
Yes. The URL updates automatically as you type. Copy it from the address bar or use the Share button, and anyone who opens the link will see your exact operands and operation ready to go.
Related tools
AES Text Decryption
Decrypt AES-256 encrypted text with your password in your browser. Free, private, and fully offline. No data leaves your device.
AES Text Encryption
Encrypt text with a password using AES-256 in your browser. Free, private, and fully offline. Nothing is sent to a server.
Aspect Ratio Calculator
Calculate aspect ratios, find a missing width or height, and resize images or video while keeping the same proportions. Free and instant.