Tools / Bit Shift Calculator

Bit Shift Calculator

Quickly apply left or right bit shifts to numbers from binary, octal, decimal, or hexadecimal inputs and view the results in every base simultaneously.

Number Base

Shift Direction

Converted values

Decimal

480

Binary

111100000

Hexadecimal

1e0

Octal

740

How it works

A left shift by n bits multiplies by 2n; a right shift divides (integer). In binary, this is just moving the bit pattern left or right and filling with zeros.

Challenges solved with this tool: picoCTF 2024 - Binhexa.

There are two flavors of right shift. A logical right shift always fills vacated bits on the left with zeros, treating the value as unsigned. An arithmetic right shiftreplicates the sign bit, preserving the sign of a two's-complement integer. In most high-level languages, >> on a signed type is arithmetic, while on an unsigned type it is logical. CTF reverse engineering problems often involve tracking which kind of shift the original code used.

Left shifts and right shifts are frequently used in custom encoding and obfuscation schemes. A value may be constructed by shifting sub-values into specific bit positions and ORing them together. For example, (a << 8) | b packs two bytes into a 16-bit word. Recognizing this pattern in decompiled code is a key reverse engineering skill.

In CTF challenges involving custom hash functions or checksums, shift operations are combined with XOR and addition to mix bits. If you see a sequence of shifts by constants like 7, 13, or 17, you are likely looking at a bit-rotation or mixing round from a hash-like construction. Use this calculator to verify what each individual shift step produces.