Home

Bitwise Calculator

Calculate AND, OR, XOR, NOT and bit shifts for 8, 16, 32 or 64 bits, with signed and unsigned results and a bit diagram.

Enter your numbers

Live calculation
Try an example:

AND, OR and XOR use two inputs; NOT and shifts use only A.

Explicit word size. Every bitwise result is limited to this width.

Use the input base and signedness shown below. Values must fit the selected word size; matching prefixes are allowed.

Use the input base and signedness shown below. Values must fit the selected word size; matching prefixes are allowed.

Also included in this result: Input base: 10 · Interpretation: Unsigned.

Additional settings (2)

Whole-number radix from 2 to 36. Common bases: binary 2, octal 8, decimal 10, hexadecimal 16.

Signed uses two’s complement and arithmetic right shift. Unsigned right shift inserts zeros.

Results update as you type. Example values are editable.

Result

0

8-bit unsigned decimal result.

Binary and hexadecimal show the complete bit pattern at the selected word size.

Result bits

Most significant bit first. Each cell shows its position and value.

Inputs stay on this page. Reloading clears unsaved changes.

More results, charts and tables
Binary00000000
Hexadecimal0x00
Signed decimal0
How it is calculated
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
MeasureResult
Binary00000000
Hexadecimal0x00
Signed decimal0

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.