Bit Shift Calculator

Enter an integer and a shift amount to compute its bitwise shift.

How it is calculated

The value is rounded to a whole number and shifted by the chosen number of bit positions in a signed 64-bit integer. Left shift: result = value × 2n. Right shift: result = floor(value ÷ 2n), an arithmetic shift that keeps the sign, so negatives round toward minus infinity (-7 shifted right by 1 gives -4).

The shift amount n must be a whole number from 0 to 63, and the value must not exceed 253 in size. A left shift that would overflow the signed 64-bit range (for example 1 shifted left by 63) returns no result instead of wrapping. Negative results are shown in decimal with a minus sign, but the hex and binary rows show the 64-bit two's-complement pattern, so -5 appears as 0xFFFFFFFFFFFFFFFB.

Worked example

Shift 13 left by 3 positions. In binary 13 is 1101. Moving every bit three places to the left and filling the right with zeros gives 1101000. That equals 13 × 23 = 13 × 8 = 104. The tool also shows the hexadecimal form 0x68 (6 × 16 + 8 = 104) and the binary form 0b1101000.

Try this example →

Common mistakes

  • Expecting a right shift of a negative number to round toward zero: it rounds down, so -7 >> 1 is -4, not -3.
  • Reading the hex and binary rows of a negative result as the number's magnitude: they are the 64-bit two's-complement pattern, which is why -5 shows a long run of F's and 1s.
  • Entering a shift of 64 or more, or a negative shift, and expecting it to wrap around: the tool only accepts 0 to 63 and gives no result outside that range.
  • Assuming a left shift is always the same as multiplying by 2n: that holds only while the result fits in a signed 64-bit integer, and 1 shifted left by 63 is rejected.
  • Typing a decimal value such as 13.6 and expecting a fractional result: bit shifts work on integers, so the input is rounded to 14 first.

About this calculator

A bitwise shift moves every bit in an integer's binary representation left or right by a given number of positions. A left shift (<<) inserts zero bits on the right and is equivalent to multiplying by 2ⁿ; a right shift (>>) drops bits off the right and is equivalent to integer division by 2ⁿ; for negative numbers this tool, like most languages, uses an arithmetic shift, which keeps the sign bit (rounding toward minus infinity). This tool applies either operation to your integer and shows the result in decimal, hexadecimal and binary side by side.

Software engineers, embedded systems developers and computer science students use bit shifts constantly for fast power-of-two arithmetic, packing multiple values into a single integer (flags, RGB color channels, network protocol headers), and implementing hash functions or checksums — operations like CRC and many cryptographic primitives are built almost entirely from shifts and XORs because they execute in a single CPU cycle, far faster than a general multiply or divide.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    This calculator works in a signed 64-bit integer, which matters when you compare with code you wrote elsewhere. Shifting 1 left by 31 gives 2147483648 here, while a 32-bit signed integer in C or JavaScript wraps that into a negative number. A left shift that would overflow 64 bits returns nothing instead of wrapping. If your result differs from your program, check the integer width first. Which language are you checking against?

Popular calculators

All Calculators