---
tag: m0412
title: Filament Runout
brief: Get/set filament runout detection parameters
author: thinkyhead

requires: FILAMENT_RUNOUT_SENSOR
since: 2.0.0
group: control

codes: [ M412 ]

notes:
  - Requires `FILAMENT_RUNOUT_SENSOR`.
  - Parameter `D` requires `FILAMENT_RUNOUT_DISTANCE_MM`.
  - Parameter `H` requires `HOST_ACTION_COMMANDS`.

parameters:
  -
    tag: D
    optional: true
    description: Set the filament runout distance.
    values:
      -
        type: float
        tag: linear
  -
    tag: H
    optional: true
    description: Flag to enable or disable host handling of a filament runout.
    values:
      -
        type: bool
  -
    tag: S
    optional: true
    description: Flag to enable or disable Filament Runout Detection. If omitted, the current enabled state will be reported.
    values:
      -
        type: bool

  -
    tag: R
    optional: true
    description: Flag to reset the filament runout sensor. Not needed with `S`.
    values:
      -
        type: bool

examples:
  -
    pre: Enable (and reset) filament runout detection
    code: M412 S1
  -
    pre: Disable filament runout detection
    code: M412 S0
  -
    pre: Report filament runout state
    code: |
      M412
      Filament runout ON
  -
    pre: Set filament runout distance
    code: |
      M412 D35 ; requires FILAMENT_RUNOUT_DISTANCE_MM
      M412
      Filament runout ON
      Filament runout distance (mm): 35

---

Get or set filament runout status and distance. Omit all parameters to get a report of the current stats. Enable or disable filament runout detection with `S` and set distance with `D`. When filament sensors are enabled, Marlin will respond to a filament runout by running the configured G-code (usually [`M600` Filament Change](/docs/gcode/M600.html)). When filament runout detection is disabled, Marlin will take no action for filament runout.
