Binary Bit Shift Calculator

Use this Calculator to quickly shift binary values left or right and convert them between decimal, binary, octal, and hexadecimal formats.

Decimal only accepts digits 0 through 9.
Octal only accepts digits 0 through 7.
Hexadecimal only accepts digits 0 through 9 and letters A through F.
Binary only accepts 0 and 1.

Binary Bit Manipulation

Click any bit to toggle it, or use the shift buttons below.

31 24
23 16
15 8
7 0

How to Use the Calculator?

To use this calculator, simply enter a value in any input field, such as decimal, binary, octal, or hexadecimal, and the calculator will instantly show the matching values in the other fields.

You can click individual bits to turn them on or off, or use the shift left and shift right buttons to move the value. Use Set All to turn every bit on, and Clear All to reset everything back to zero.

What Is Bit Shifting?

A bit is the smallest unit of data in a computer. It can only have two values: $0$ or $1$.

A group of bits can represent a number. For example, the binary number $1010_2$ represents the decimal number $10_{10}$. The subscript $2$ means “base 2,” which is binary. The subscript $10$ means “base 10,” which is decimal.

Bit shifting is a way of moving the bits in a binary number to the left or to the right. When we shift left, every bit moves one position to the left. When we shift right, every bit moves one position to the right. New empty positions are usually filled with $0$. Bits that move outside the range are lost.

Understanding the Place Value of Binary Bits

Before learning bit shifting, you need to understand binary place value.

In decimal, each digit position is worth a power of $10$. For example, in $345_{10}$, the $5$ is in the ones place, the $4$ is in the tens place, and the $3$ is in the hundreds place.

decimal number system

Binary works in a similar way, but instead of powers of $10$, it uses powers of $2$. The rightmost bit has a value of $2^0$, which is $1$. The next bit to the left has a value of $2^1$, which is $2$. The next position is $2^2$, which is $4$, and so on. Each position is worth twice as much as the position to its right.

For example, the binary number $00001010_2$ has a $1$ in the $3$rd place and a $1$ in the $1$st place. So its decimal value is $2^3+2^1=8+2=10$. That is why $00001010_2$ equals $10_{10}$.

binary number system

Left Shift as Multiplication by Powers of Two

A left shift moves every bit one position to the left. When this happens, each $1$ bit moves into a position with double the place value. Because of that, shifting left by one position usually multiplies the number by $2$. Shifting left by two positions usually multiplies the number by $4$, because $4$ is $2^2$. Shifting left by three positions usually multiplies the number by $8$, because $8$ is $2^3$.

$$\text{Left shift by }n\text{ positions usually means multiplying by }2^n$$

Let’s start with $00001010_2$, which equals $10_{10}$. If we shift it left by one position, it becomes $00010100_2$. The value is now $20_{10}$.

binary left shift

The bits moved left, and a $0$ was added on the right side. This matches the rule because $10 \times 2 = 20$.

$$00001010_2 \ll 1 = 00010100_2$$

$$10_{10}\times 2=20_{10}$$

Now shift $00001010_2$ left by two positions. The result is $00101000_2$, which equals $40_{10}$. This time the number was multiplied by $4$, because shifting left two places is the same as multiplying by $2^2$.

$$00001010_2 \ll 2 = 00101000_2$$

$$10_{10}\times 2^2=10_{10}\times 4=40_{10}$$

This is one of the most useful ideas in bit shifting. A computer can multiply by powers of $2$ very quickly by shifting bits left. Instead of doing normal multiplication, it can simply move the bits. This is why bit shifting is often used in low-level programming, computer graphics, memory operations, and digital electronics.

Right Shift as Division by Powers of Two

A right shift moves every bit one position to the right. When a bit moves to the right, it moves into a position with half the place value. Because of that, shifting right by one position usually divides the number by $2$. Shifting right by two positions usually divides the number by $4$, and shifting right by three positions usually divides the number by $8$.

$$\text{Right shift by }n\text{ positions usually means dividing by }2^n$$

For example, start with $00101000_2$, which equals $40_{10}$. If we shift it right by one position, it becomes $00010100_2$, which equals $20_{10}$.

binary right shift

This matches the rule because $40 \div 2 = 20$.

$$00101000_2 \gg 1 = 00010100_2$$

$$40_{10}\div 2=20_{10}$$

If we shift $00101000_2$ right by two positions, it becomes $00001010_2$, which equals $10_{10}$. This matches the rule because $40 \div 4 = 10$.

$$00101000_2 \gg 2 = 00001010_2$$

$$40_{10}\div 2^2=40_{10}\div 4=10_{10}$$

However, you should keep in mind that, bits that move outside the range are lost. Therefore, if the number is odd, information will be lost when shifting to the right.

For example, $00000101_2$ is $5_{10}$. If we shift it right by one position, it becomes $00000010_2$, which is $2_{10}$. Mathematically, $5 \div 2 = 2.5$, but binary integer shifting does not keep the decimal part. The fractional part is discarded.

$$00000101_2 \gg 1 = 00000010_2$$

$$5_{10}\div 2=2.5,\quad \text{but integer shifting gives }2_{10}$$

So, right shifting is very useful when we want to divide whole numbers by powers of $2$.

Summary

Bit shifting is useful because computers are built from circuits that work naturally with bits. Moving bits left or right is a simple operation for hardware. This is why programmers use shifting when they need to perform efficient multiplication or division by powers of $2$.

Amrit Prabhu

Amrit Prabhu

Amrit is an Electronics Engineer who loves making complex programming and hardware concepts accessible. He has more than 15 years of experience, having worked as a Senior Programmer Analyst at Mindtree Ltd. and Symantec on major projects like Windows 8, Wolters Kluwer CCH and NSE. Since 2018, he has authored hundreds of tutorials and guides for Last Minute Engineers, helping readers master everything from basic circuits to IoT. You can find him on LinkedIn