Handy Orchard

Bitwise operation lab

Inspect fixed-width logical operations and shifts with exact binary, hexadecimal and signed interpretations.

Your input

Decimal, 0x hex or 0b binary, optionally negative. Values outside the width’s signed-to-unsigned range are rejected.

Outputs are cleared when the input changes.

Result

Enter your data or use the example, then run the tool.

Worked example

At 8 bits, NOT 0 gives unsigned 255 and signed −1.

0x80 shifted right by 1 gives 0xC0/−64 arithmetically and 0x40/64 logically.

Method

BigInt operations apply a mask of 2^width−1. Signed display interprets the top bit as two’s complement.

Logical right shift fills zeros; arithmetic right shift extends the sign bit.

Limits

Only 8/16/32/64-bit widths. Shift count must be 0 to width−1; operands are at most 100 characters.

No C/C++ undefined-behavior emulation, floating-point bit reinterpretation or arbitrary-precision base conversion.

Sources

MDN: BigInt bitwise semantics

Related tools

Boolean truth tableText list set operationsFraction arithmeticNumber base converter

Your inputs stay on this device. Only optional, consented page visits are measured. Input values, files, filenames and processing logs are not sent to Analytics.

When switching languages, text, settings and selected files are temporarily kept on this device. Transfers are removed after restoring; interrupted transfers are cleaned up on a later visit. Inputs and files are never uploaded.