# `mul`

[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/mul

**Unsigned multiply**

Category: Arithmetic

Multiplies unsigned integers into the full implicit product in the one-operand form.

8086 and later

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

Used in: [Arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/arithmetic-logic-and-bits.md) (x86-64 assembly), [Multiply and divide, with the remainder](https://asm-editor.specy.app/learn/courses/x86/examples/multiply-and-divide.md) (x86-64 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| CF | depends on the result |
| PF | undefined (do not rely on it) |
| AF | undefined (do not rely on it) |
| ZF | undefined (do not rely on it) |
| SF | undefined (do not rely on it) |
| DF | not changed |
| OF | depends on the result |

## Forms

- `mul r/m` (8, 16, 32, 64)
  - `mul r/m8`
  - `mul r/m16`
  - `mul r/m32`: 386 and later
  - `mul r/m64`
- `mul reg, r/m` (16, 32, 64)
  - `mul reg16, r/m16`: 386 and later
  - `mul reg32, r/m32`: 386 and later
  - `mul reg64, r/m64`
- `mul reg, r/m, imm` (16, 32, 64)
  - `mul reg16, r/m16, imm8`: 186 and later
  - `mul reg32, r/m32, imm8`: 386 and later
  - `mul reg64, r/m64, imm8`
  - `mul reg16, r/m16, imm16`: 186 and later
  - `mul reg32, r/m32, imm32`: 386 and later
  - `mul reg64, r/m64, imm32`

## Operands

- `r/m`: A general-purpose register or memory location matching the operation’s size, for example `rax` or `qword [rbp-8]`.
- `reg`: A general-purpose register matching the operation’s size, for example `al`, `ax`, `eax` or `rax`.
- `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

Its explicit source width selects the implicit other factor and full product: 8 bits uses `al` and produces `ax`; 16 bits uses `ax` and produces `dx:ax`; 32 bits uses `eax` and produces `edx:eax`; 64 bits uses `rax` and produces `rdx:rax`. The register before the colon holds the high half. CF and OF are set when that high half is nonzero.

NASM also accepts two- and three-operand `mul` spellings as aliases of the corresponding `imul` forms. These keep only the destination-width low product; their overflow flags follow signed `imul` rules. Use the one-operand form when you need the full unsigned product.

## Example

```x86
global _start

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

        mul rax

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