{"id":"gcode-g98","model_id":"G98","name":"LinuxCNC G98","summary":"G98 is a G-code that selects the retract level used at the end of canned cycles such as drilling and boring. In this mode the tool returns to the Z position it held just before the series of contiguous canned cycles began, if that position is higher than the R value; otherwise the R value is used. It is the alternative to G99, which always retracts to the R position.","study_notes":["G98 retracts to the position the axis was in just before the series of one or more contiguous canned cycles was started, provided it is higher than the R value; if lower, the R value is used.","G99 instead retracts to the position specified by the R word of the canned cycle.","G98 is also referred to in the document as OLD_Z retract mode.","The initial (G98) plane is reset any time cycle motion mode is abandoned, whether explicitly with G80 or implicitly with any motion code that is not a cycle.","Switching among cycle modes (for example G81 to G83) does not reset the initial plane.","It is possible to switch between G98 and G99 during a series of cycles.","Documented example: G0 X1 Y2 Z3 followed by G90 G98 G81 X4 Y5 Z-0.6 R1.8 F10 returns to Z3 because it is higher than the R value of 1.8."],"safety_notes":[],"sources":[{"url":"https://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g98-g99","title":"G-Codes","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":2,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"gcode","code":"G98","group":"Canned Cycle Return Level","parameters":[],"dialect":"LinuxCNC","related":[],"standards":[]},"url":"https://machineschema.com/instruction/gcode-g98","license":"https://creativecommons.org/licenses/by/4.0/"}