# `srl`

[MIPS Documentation](https://asm-editor.specy.app/documentation/mips.md) › [Instructions](https://asm-editor.specy.app/documentation/mips/instruction.md)

Web page: https://asm-editor.specy.app/documentation/mips/instruction/srl

**Shift right logical**

Category: Shifts and rotates

Shifts the second register right by a fixed amount of 0 to 31 bits, filling vacated bits with zeros, and stores the result in the first.

Used in: [Arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/mips/think-in-assembly/arithmetic-logic-and-bits.md) (MIPS assembly), [Exceptions and coprocessor 0](https://asm-editor.specy.app/learn/courses/mips/talking-to-the-outside-world/exceptions-and-coprocessor-0.md) (MIPS assembly), [Masks, shifts, popcount, and leading zeroes](https://asm-editor.specy.app/learn/courses/mips/examples/bit-tricks.md) (MIPS assembly), [Binary search](https://asm-editor.specy.app/learn/courses/mips/examples/binary-search.md) (MIPS assembly), [The snake game](https://asm-editor.specy.app/learn/courses/mips/examples/snake.md) (MIPS assembly), [Flappy ASM](https://asm-editor.specy.app/learn/courses/mips/examples/flappy-asm.md) (MIPS assembly), [Sampled sound](https://asm-editor.specy.app/learn/courses/mips/examples/sampled-sound.md) (MIPS assembly)

## Forms

- `srl $t1, $t2, imm5`

## Operands

- `$t1`: Any general-purpose register, `$0` to `$31`, using its numeric or named spelling, such as `$8` or `$t0` (`$zero` is `$0`; `$ra` is `$31`).
- `$t2`: A general-purpose register. It may be the same register as `$t1`.
- `imm5`: An unsigned 5-bit immediate, `0` to `31`, used for values such as a shift count.

## Description

Vacated bits on the left are filled with 0 (unsigned shift). Shifting right by n is equivalent to unsigned division by 2^n. Use 'sra' to preserve the sign bit instead.

## Example

```mips
# Shift or rotate an initialized word; inspect $t2: 18.
li $t0, 0x48
srl $t2, $t0, 2
```
