# leftShift() Function & Examples

Use the leftShift() bitwise function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## leftShift

#### x << y

#### leftShift(x, y)

Try it yourself:

```calculio
4 << 1
8 >> 1
```

---

## leftShift(): Shifting Integer Bits Left

**leftShift()** shifts an integer’s binary bits left by a specified count. For nonnegative integer arithmetic, shifting left by n generally multiplies by 2ⁿ, provided no fixed-width overflow rule changes the representation.

## Bit-level caveats

Use integer operands and a nonnegative shift count. Bitwise operations operate on binary representations, not decimal digits. Compare it with [rightArithShift()](https://calcul.io/function/rightArithShift/index.md) and [rightLogShift()](https://calcul.io/function/rightLogShift/index.md), which have different sign behavior.

Use [bitAnd()](https://calcul.io/function/bitAnd/index.md) to test flags and [bitOr()](https://calcul.io/function/bitOr/index.md) to combine them. Confirm your target integer range before shifting large values, because precision and sign rules affect results.

[All functions](https://calcul.io/functions/index.md)
