# Z offset in Marlin is not working recently

My printer is ignoring the "Z offset" setting in Cura and the "Bed Z" stored in the printer LCD settings? It has been working before but after a firmware update of my printer, it doesn't work. Even after flashing the previous firmware back "Bed Z" changes no longer affect anything. No matter if I change "Bed Z" during prints or if I use the "Z offset" option in Cura, the nozzle still prints at the same height.

## 2 Answers

I have the same problem. You need to check your G-code to detect where's the problem.

Try comparing the G-code file with different values of the Z offset.

In my case it looks like this:

No offset

;LAYER_COUNT:107
;LAYER:0
M106 S255
G1 F300 Z0.84
G0 F6000 X124.645 Y78.208 Z0.84
;TYPE:SKIRT
G1 F300 Z0.44
G1 F1500 E0


With offset (comments made by Cura)

;LAYER_COUNT:107
;LAYER:0
M106 S255
G1 F300 Z2.06 ;adjusted by z offset
G92 Z0.84 ;consider this the original z before offset
G0 F6000 X119.093 Y42.498 Z0.84
;TYPE:SKIRT
G1 F300 Z0.44


I hope this helps.

• This addresses the inserted G-code offset by Cura, it doesn't address why the firmware stored offset isn't applied. Any chance you can add to that since you have the same issue? – 0scar May 19 '20 at 6:22

## Z offset in Cura

Z offset in Cura is nothing more than an additional increase/decrease in height calculated throughout the whole file. This does require the installment of a plugin from the Ultimaker Cura "Marketplace" called "Z Offset Setting" by developer "fieldOfView". This should work (if not, this implies the plugin is defective, version 3.5.7 appears to work as it should which is the latest version to date), the G-code is parsed (as in post-processed) by the plugin to recalculate all Z values (a redefinition of the Z level with G92 might have been a lot easier...), as an example an object is sliced without an offset, a negative offset (-0.333 mm) and a positive offset (0.333 mm) below. The layer numbered ;LAYER:0 will start printing at:

No offset:

G0 F4285.7 X81.669 Y84.791 Z0.27


Negative offset:

G0 F4285.7 X81.669 Y84.791 Z-0.063 ;adjusted by z offset


Positive offset:

G0 F4285.7 X81.669 Y84.791 Z0.603 ;adjusted by z offset


## Z offset in firmware

A Z offset is the distance between the nozzle and the build plate surface that is needed for good adhesion. This is obtained from levelling the bed putting a piece of A4/Letter paper in between the nozzle and build plate during levelling of the bed. Basically this is an offset from the endstop position. Using the menu of a Marlin operated printer you can manually adjust this value e.g. during printing of the first layer by turning the jog dial for Z babystepping. The paper levelling method is a manual/mechanical Z offset that can be extended with the value changed by the menu. When storing such an offset you basically change the offset from the endstop position, this can be done with G-code M206. Storing the value to be retained for future prints, the value needs to be stored to memory (using G-code M500 or an equivalent save settings from the menu of the printer controller).

Note this offset is something different when using a Z probe. The Z probe offset in firmware is set by M851 or G29.1, depending on the used firmware.