The bit shift calculator lets you execute bit shifts to the left and bit shifts to the right. The logical shift operation can be done with input from the binary, octal, and decimal number systems, and the calculator gives the results in signed and unsigned representations.
What is a bit shift left and bit shift right?
A bit shift is a bitwise operation executed on a binary number. To understand this better, let's take a look at the concept step by step.
Binary numbers are numbers founded on the base 2 system. You can refresh your knowledge of this other numerical system at the binary converter. Base 2 means that each digit can only have the values and , representing a bit, the smallest unit of digital information. One bit can only display two logical states: on or off. To make up larger amounts of information, bits are lined up to form binary numbers. With those, arithmetic operations like binary subtraction can be executed trouble free.
Binary numbers can be converted to numbers in the decimal system. In the case of negative numbers in the decimal system, there is a so-called signed representation, allowing to display those in the binary system.
So what is a bit shift? A bit shift is an operation where a succession of bits is moved either to the left or the right. For logical bit shifts, the bits shifted out of the binary number's scope are lost, and 0's are shifted in on the other end. This differentiates this method from the circular and arithmetic bit shift. Bit shifts are not the only bitwise operations; further important ones are AND, OR, and XOR: meet them at Omni's logic gate calculator and bitwise calculator!
The picture above shows an example of bit shifts to the right and left. Input is the binary number , or .
- The right bit shift moves every bit of the input one position to the right. Thereby, the least significant bit is lost, while a is pushed in on the other end.
- The left bit shift moves every bit of the input one position to the left. A is pushed in on the right end to fill up the bit succession.
The bit shift is an important operation to perform mathematical operations efficiently. In the example above, we shifted the binary number , or in the decimal system, one bit to the left. The result is , or in the decimal system. So shifting one bit to the left is equal to multiplying a number by the factor . Shifting two bits means multiplying by , bits by , and so on. This concept also works the other way around: a bit shift to the right equals a division by . Additionally, bit shifts are also significant for the digital electronics field of registers.
How to use the bit shift calculator?
You now know what a bit shift is and how to execute a logical shift. So let's take a look at how to use the bit shift calculator. As an example, we will execute a bit shift left. We shift the number in the decimal system bits to the left, using the tool as a left shift calculator.
- Choose the number of bits in the binary representation. Since 8 bits enable the input of numbers in the range to in the decimal system, this is sufficient for our cause.
- Choose your input datatype. The bit shift calculator supports numbers from the binary, octal, and decimal systems. We choose decimal.
- Input your data in the field Number in the corresponding numeral system. For our example, we put here .
- Choose your shifting direction, either Left or Right, to operate the tool as a left shift calculator or right shift calculator. We choose Left.
- The bit shift calculator presents your result as numbers from the binary, decimal, and octal systems:
In case your binary result starts with a and could therefore be interpreted as a positive result in unsigned notation or a negative result in signed notation, both results will be displayed.
What is bit shifting?
Bit shifting describes the operation of shifting a string of bits a certain number of positions to the left or the right. For example, the binary number
0001 0101 shifted 1 bit to the left is
How do I calculate a left shift by 3 bits?
To calculate a left shift by 3 bits, follow these steps:
- Get your number in a binary format, e.g.,
- Shift your bit string 3 positions to the left, discarding the digits falling out of scope, and filling up from the right with 0's:
- And that's it; you performed a shift of 3 bits to the left.
What is a logical bit shift?
A logical bit shift is an operation in which a succession of bits is either shifted to the left or the right by a certain number of positions, and the empty digits of the binary number are filled up with 0's.
How do I multiply by 8 using bit shifts?
To multiply a number by 8 using bit shifts, do the following:
- Get your number in binary format.
- Shift your binary number 3 bits to the left.
- That's it; you performed multiplication by 8 using bit shifts.