🚀 New content added!
📚 Guide February 5, 2026 5 min read

Klipper Automation: The Power of START_PRINT and END_PRINT Macros (Part 4)

Forget those complex start codes in your slicer. Add smart features to your printer with Klipper macros. Start_Print, End_Print and filament change (M600) settings are here.

📜 START_PRINT & END_PRINT Macros

Custom start and end codes for Klipper

🎯 Why Are Macros Important?

🔄

Central Management

Control all settings from printer.cfg without changing slicer

🌡️

Dynamic Parameters

Automatically receive temperature values from slicer

🧹

Clean Start

Nozzle cleaning, prime line and bed mesh automation

🛡️

Safe Shutdown

Safely shut down the printer and prepare for next print

🚀 START_PRINT Macro

This macro runs automatically at every print start:

[gcode_macro START_PRINT] gcode: # Get parameters from slicer {% set BED_TEMP = params.BED_TEMP|default(60)|float %} {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} # Initial settings G90 ; Absolute positioning M83 ; Relative extrusion G28 ; Home all axes # Heat bed (wait) M190 S{BED_TEMP} # Bed mesh (optional) BED_MESH_CALIBRATE # Heat hotend M109 S{EXTRUDER_TEMP} # Draw prime line G1 Z5 F3000 G1 X10 Y10 F5000 G1 Z0.3 G1 X100 E20 F1000 G1 X110 F5000 G92 E0 ; Reset E value
💡 Tip: If you don't want to run bed mesh every print, use BED_MESH_PROFILE LOAD=default to load a pre-saved profile.

🏁 END_PRINT Macro

Provides safe shutdown when print finishes:

[gcode_macro END_PRINT] gcode: # Print complete settings M400 ; Wait for buffer G92 E0 ; Reset E G1 E-2 F2700 ; Short retract G91 ; Relative positioning # Raise nozzle G1 Z10 F3000 # Present part G90 ; Absolute positioning G1 X10 Y200 F5000 # Turn off heaters M104 S0 ; Hotend off M140 S0 ; Bed off M106 S0 ; Fan off # Disable motors M84 ; Steppers off

⚙️ Slicer Settings

You need to edit start/end G-codes in your slicer to use macros:

SlicerStart G-codeEnd G-code
OrcaSlicer / PrusaSlicer START_PRINT BED_TEMP=[bed_temperature_initial_layer_single] EXTRUDER_TEMP=[nozzle_temperature_initial_layer] END_PRINT
Cura START_PRINT BED_TEMP={material_bed_temperature_layer_0} EXTRUDER_TEMP={material_print_temperature_layer_0} END_PRINT
SuperSlicer START_PRINT BED_TEMP=[first_layer_bed_temperature] EXTRUDER_TEMP=[first_layer_temperature] END_PRINT
⚠️ Important: Don't forget to remove existing slicer start codes (heating, homing etc.)! Otherwise double operations will occur.

🔧 Additional Helper Macros

CANCEL_PRINT - Print Cancellation

[gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT gcode: END_PRINT BASE_CANCEL_PRINT

PAUSE / RESUME

[gcode_macro PAUSE] rename_existing: BASE_PAUSE gcode: {% set X = params.X|default(10)|float %} {% set Y = params.Y|default(10)|float %} {% set Z = params.Z|default(10)|float %} SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE G91 G1 Z{Z} F3000 G90 G1 X{X} Y{Y} F5000 [gcode_macro RESUME] rename_existing: BASE_RESUME gcode: RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME

🎉 Macros Ready!

Your basic macros are now working. For more advanced features, check out the jschuh macro collection!

Next: Advanced jschuh Macros →
All Guides