# `lea`

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

Web page: https://asm-editor.specy.app/documentation/x86/instruction/lea

**Load effective address**

Category: Data movement

Computes the effective address of the memory operand and stores it in the destination register, without accessing memory.

8086 and later

[Intel's reference: LEA](https://intel.github.io/SDM/instruction/LEA.html)

Used in: [Effective addresses](https://asm-editor.specy.app/learn/courses/x86/introduction/effective-addresses.md) (x86-64 assembly), [Sections, directives and labels](https://asm-editor.specy.app/learn/courses/x86/introduction/sections-directives-and-labels.md) (x86-64 assembly), [Memory regions and executable files](https://asm-editor.specy.app/learn/courses/x86/introduction/memory-regions-and-executable-files.md) (x86-64 assembly), [Loops](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/loops.md) (x86-64 assembly), [Arrays, strings and the string instructions](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/arrays-strings-and-the-string-instructions.md) (x86-64 assembly), [call, ret and the System V convention](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/call-ret-and-the-system-v-convention.md) (x86-64 assembly), [Floating point and the x87 stack](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/floating-point-and-the-x87-stack.md) (x86-64 assembly), [syscall and the Linux x86-64 ABI](https://asm-editor.specy.app/learn/courses/x86/talking-to-the-outside-world/syscall-and-the-linux-abi.md) (x86-64 assembly), [Sum of an array](https://asm-editor.specy.app/learn/courses/x86/examples/sum-of-an-array.md) (x86-64 assembly), [Length of a string](https://asm-editor.specy.app/learn/courses/x86/examples/string-length.md) (x86-64 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | not changed |
| OF | not changed |

## Forms

- `lea reg, mem` (16, 32, 64)
  - `lea reg16, mem`
  - `lea reg32, mem`: 386 and later
  - `lea reg64, mem`
- `lea reg, imm` (16, 32, 64)
  - `lea reg16, imm16`
  - `lea reg32, imm32`: 386 and later
  - `lea reg64, imm32`

## Operands

- `reg`: A general-purpose register matching the operation’s size, for example `al`, `ax`, `eax` or `rax`.
- `mem`: A memory location addressed with square brackets, for example `[rbx+8]` or `[label]`.
- `imm`: An immediate value: a constant written in the instruction as a number, a character or a label, for example `10`, `0x1f`, `'a'` or `msg`. Open a row to see the size it has in each form, such as `imm8` or `imm32`.

## Description

For example, `lea rax, [rbx + rcx*4 + 8]` stores that address calculation in `rax`. The brackets describe the calculation; they do not cause a load. NASM also accepts an absolute constant without brackets, such as `lea rax, 0x1000`.

In 64-bit mode the address calculation uses 64-bit registers by default, or 32-bit registers with the 32-bit address size; 16-bit addressing is unavailable. The destination independently selects a 16-, 32- or 64-bit result. A narrower destination retains the low bits, and a 32-bit register write clears its upper 32 bits. A 32-bit address calculation stored in a 64-bit destination is zero-extended.

## Example

```x86
global _start

section .data
value: dq 7

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        lea rax, [value]

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall
```
