Operations use exact BigInt values and an explicit 8-, 16-, 32- or 64-bit mask. AND keeps bits set in both inputs; OR in either input; XOR in exactly one; NOT flips every bit within the word. Left shift discards high bits outside that word. Unsigned right shift inserts zero bits; signed right shift repeats the sign bit. Shift count must be a whole number from 0 to word size − 1. Signed mode uses two’s complement. Decimal signed inputs must be in the signed range. In other bases, positive values up to the unsigned maximum may supply a raw bit pattern: hexadecimal FF at 8 bits is signed −1. This model is explicit and does not claim identical overflow or shift-count behavior across all programming languages.
Bitwise Calculator
CalcsDecoded.com
Result
0
8-bit unsigned decimal result.
Binary and hexadecimal show the complete bit pattern at the selected word size.
Result breakdown
Measure
Result
Binary
00000000
Hexadecimal
0x00
Signed decimal
0
Inputs used
Operation: AND: A & B
Word size: 8 bits
Integer A: 240
Integer B: 15
Input base: 10
Interpretation: Unsigned
Method and assumptions
Operations use exact BigInt values and an explicit 8-, 16-, 32- or 64-bit mask. AND keeps bits set in both inputs; OR in either input; XOR in exactly one; NOT flips every bit within the word. Left shift discards high bits outside that word. Unsigned right shift inserts zero bits; signed right shift repeats the sign bit. Shift count must be a whole number from 0 to word size − 1. Signed mode uses two’s complement. Decimal signed inputs must be in the signed range. In other bases, positive values up to the unsigned maximum may supply a raw bit pattern: hexadecimal FF at 8 bits is signed −1. This model is explicit and does not claim identical overflow or shift-count behavior across all programming languages.
Examples and assumptions
Choose a word size and interpretation explicitly. Results show the same bit pattern in binary, hexadecimal and signed or unsigned decimal.
8-bit XOR
255 = 11111111 = 0xFF.
11110000 XOR 00001111 sets all eight bits.
Signed right shift
-1 = 11111111 = 0xFF.
The eight-bit pattern for -2 is 11111110. Arithmetic right shift repeats the sign bit.
64-bit precision
9223372036854775809.
OR sets bit 0 while preserving bit 63. The calculation does not use 32-bit Number bitwise operators.
Before you use the result
Supported word sizes: 8, 16, 32 and 64. Inputs outside the selected range are rejected.
Signed decimal inputs must fit the signed range. Other bases may supply a positive raw bit pattern; for example, FF in signed 8-bit mode represents -1.
Left shift discards high bits. Right shift is arithmetic in signed mode and logical in unsigned mode. Shift counts are restricted to 0 through word size minus one. These explicit rules can differ from a particular programming language.
Calculation checks and references
Independent finite-word references verify all operations, every width, both signedness modes, high 64-bit values, sign extension, truncation and input boundaries. The bit diagram is rendered from the calculated result.
Reference cases checked: . Checks are automated reference calculations; an independent professional review is not claimed.
References explain definitions, rules or context; they do not endorse CalcsDecoded.com. See our calculation methodology for the testing and updating standard.
Frequently asked questions
Why does FF become -1 in signed 8-bit mode?
The eight set bits represent 255 unsigned or -1 using signed two’s complement. The bits are the same; their interpretation changes.
Does left shift keep overflow bits?
No. Bits outside the chosen word size are discarded. The result is a fixed-width pattern.
What does right shift do?
Unsigned mode inserts zeros at the left. Signed mode repeats the sign bit. The count must be from zero through word size minus one.
Report a problem or send feedback
Report a problem or send feedback
Tell us what went wrong or how we can improve this calculator. Please don't include financial or other sensitive information.