Logical Shift and Arithmetic Shift are two of the most important concept in computer programming. Both are bit manipulation operations (bitwise operations).

An arithmetic shift is a shift operator, sometimes termed a signed shift (though it is not restricted to signed operands).

A logical shift is a bitwise operation that shifts all the bits of its operand.

**In this article, we will show you the key differences between Arithmetic shift and Logical shift.**

Also check out: Inappropriate ioctl for device/ENOTTY error in Linux

## Logical Shift

The two base variants of Logical Shift are the **logical left shift** and the **logical right shift**.

- Left Logical Shift — Each bit is shifted towards left, MSB is discarded and LSB becomes 0
- Right Logical Shift — Each bit is shifted towards right, LSB is discarded and MSB becomes 0

## Arithmetic Shift

The two basic types of Arithmetic Shift are the **arithmetic left shift** and the **arithmetic right shift**.

- Left Arithmetic Shift — Each bit is shifted towards left, MSB is discarded and LSB becomes 0, hence similar to logical shift
- Right Logical Shift — Each bit is shifted towards right, LSB is discarded and MSB becomes 1

## Arithmetic shift vs Logical shift Comparison

Arithmetic shift | Logical shift |

An arithmetic shift via micro operation that shifts a signed binary number to the left and right. | A logical shift is one that transforms through the serial input. |

An arithmetic shift left multiplies assigned binary number by. An arithmetic shift right divides number by 2. | The symbols strand and for logical shift left and logical shift right Micro-operations. |

The register symbol must be same on both sides of the arrow. | It does not follow the conditions as followed by arithmetic shift micro operations. |

The bit transferred to the end position through serial input is assumed to be 0 during a logical shift. | The bit is not tranferred to the end position through serial input, since it follow difference arithmetic logic. |

## Key Differences between Arithmetic shift vs Logical shift

- Arithmetic shift preserve sign bit, whereas Logical shift can not preserve sign bit.
- Arithmetic shift perform multiplication and division operation, whereas Logical shift perform only multiplication operation.
- Arithmetic shift is used for signed interpretation, whereas Logical shift is used for unsigned interpretation.

We hope that the short article provide helpful information on the differences between Arithmetic shift vs Logical shift. You may want to check out our tutorials on common JavaScript errors such as Unexpected end of JSON input, Not allowed to load local resource, Prettier not working.

If you have any question, don’t hesitate to let us know in the comment section below.