---
tag: m0106
title: Set Fan Speed
brief: Turn on fan and set speed
author: thinkyhead

group: thermal
requires: EXTRA_FAN_SPEED

codes: [ M106 ]
related: [ M107 ]

notes:
- '`M106` with no speed sets the fan to full speed.'
- Turn off fans with [`M107`](/docs/gcode/M107.html).
- With `LASER_SYNCHRONOUS_M106_M107` `M106` will turn on the laser.

parameters:

- tag: I
  since: 2.0.6
  optional: true
  description: Material preset index. Overrides `S`.
  values:
  - type: int
    tag: index

- tag: S
  optional: true
  description: Speed, from 0 to 255. S255 provides 100% duty cycle; S128 produces 50%.
  values:
  - tag: speed
    type: int

- tag: P
  optional: true
  description: Fan index
  values:
  - tag: index
    type: int

- tag: T
  since: 1.1.7
  type: int
  requires: EXTRA_FAN_SPEED
  optional: true
  description: Secondary speed for the given fan.
  values:
  - tag: 1
    description: Use the Secondary Speed set for the given fan.
  - tag: 2
    description: After `T1` Restore the speed for the given fan.
  - tag: 3-255
    description: Set a Secondary Speed for the given fan.

examples:
- pre: Turn on the fan at 200/255 DC
  code: M106 S200
- pre: Set the Secondary Speed for Fan 1 to 128
  code: M106 P1 T128
- pre: Use the Secondary Speed that was set for Fan 1
  code: M106 P1 T1
- pre: Restore the previous fan speed
  code: M106 P1 T2

---

Turn on one of the fans and set its speed. If no fan index is given, the print cooling fan is selected. The fan speed applies to the next block added to the planner, so it will not take effect until previous moves in the planner are done. Under manual control with an idle machine, `M106` will change the fan speed immediately.
