LayerCalc

Temp Tower & Retraction Tower G-code Generator

Set your printer's bed, nozzle and layer height, choose what to test — temperature, retraction distance or retraction speed — and download a G-code file that changes the value every few millimeters. No slicer plugins, no post-processing scripts.

Printer
mm
mm
mm
Print settings
mm
mm
mm/s

Keep it modest so the test isn't a speed test.

mm/s
°C

Used for retraction tests.

°C
%

Off for layer 1, on from layer 2.

mm

Direct drive ≈0.5–1.2, Bowden ≈4–6.

mm/s
Test sequence
°C
°C

Negative to go down the tower.

sections
mm
mm

Longer gap shows stringing better.

mm

The generated file always sets M83 (relative extrusion) after your start code. Your macro must home and heat.

Tower
Section (from bottom)HeightValue

Always open the file in your slicer's preview or a G-code viewer before printing. The generator is generic; it can't know your printer's quirks.

What the generator prints

Two square pillars, two walls thick, with a brim on the first layer for adhesion. The nozzle prints one pillar's walls, travels across the gap, prints the other, and comes back — once per layer, all the way up. The tower is divided into equal-height sections and the test value changes at the start of each one:

  • Temperature tower: an M104 at each section boundary sets the new nozzle temperature. The print continues while it changes, which takes a few layers for a 5 °C step — read each section from its top half.
  • Retraction distance / speed: every travel across the gap retracts with that section's value. Everything else is held constant.

The crossing is the whole point. Stringing, oozing and blobbing all happen on travels, and a 40 mm unsupported gap between two small pillars is the harshest travel a print ever makes. Whichever section has clean pillars and a clean gap is your answer.

Reading the result

  1. Note the section values from the table above (they're also in the G-code header). Section 1 is at the bottom.
  2. For a temperature tower, look at four things per section: stringing across the gap (worse when hot), layer adhesion (try to snap a pillar — worse when cold), the gloss and smoothness of the walls, and any tiny bulges at the corners (over-extrusion when hot). Pick the coolest section with good layer bonding; for strength, go 5 °C hotter than pure looks would suggest.
  3. For retraction distance, find the first section where the strings disappear; that's your distance. Going further doesn't help and risks pulling molten plastic up into the cold end, which causes jams on Bowden printers.
  4. For retraction speed, faster usually helps up to a point where the extruder skips or the filament grinds; use the fastest section that still looks clean.

Suggested sequences

TestMaterial / setupStartStepSections
TemperaturePLA230 °C−56 (230 → 205)
TemperaturePETG250 °C−56 (250 → 225)
TemperatureABS / ASA260 °C−56 (260 → 235)
TemperatureTPU235 °C−56 (235 → 210)
Retraction distanceDirect drive0.2 mm+0.27 (0.2 → 1.4)
Retraction distanceBowden2 mm+16 (2 → 7)
Retraction speedDirect drive15 mm/s+105 (15 → 55)
Retraction speedBowden20 mm/s+105 (20 → 60)

Do temperature first, then retraction distance at the chosen temperature, then retraction speed at the chosen distance. Flow should already be calibrated with the flow rate calculator; if it isn't, over-extrusion will masquerade as "too hot".

Before you print

  • Preview the file. Drag it into PrusaSlicer, OrcaSlicer or Bambu Studio (File → Import → G-code), or any online G-code viewer, and check the pillars sit where you expect on the bed.
  • Klipper users: if you rely on a PRINT_START macro for homing, mesh loading and heating, paste it in the custom start box with {hotend} and {bed} placeholders. The built-in start does a plain G28 and heats, which is enough for most setups.
  • Bambu users: printing raw G-code works from the SD card or by importing the file into Bambu Studio and sending it as-is. The built-in start code skips Bambu's purge and calibration routine, which is fine for a small test print.
  • Deltas: tick "origin at bed center" so the pillars land around 0,0.
  • Watch the first layer. The generator can't know your Z offset. If the brim isn't sticking, stop and adjust it as you would for any print.

What it deliberately doesn't do

No infill, no overhang features, no bridges — those belong in their own tests, and combining them makes each harder to read. There is no pressure advance or linear advance tuning; use the routines built into Klipper and Marlin for that. The print settings are conservative on purpose: a calibration print should isolate one variable, and a 40 mm/s wall speed keeps the hotend well inside its volumetric limit so what you see is the temperature or retraction, not a flow problem.

Frequently asked questions

How does a temperature tower work?

It's a tall print divided into sections, each printed at a different nozzle temperature. Comparing the sections shows where layer bonding, stringing, overhangs and surface finish are best for that filament. This generator prints two thin pillars with a gap between them, so each section also shows how much the filament strings when the nozzle travels across the gap.

What temperature range should I test?

Start at the top of the manufacturer's range and step down 5 °C per section: PLA 230 → 200, PETG 250 → 220, ABS/ASA 260 → 230, TPU 235 → 205. Six sections of 5 °C covers 25 degrees. Print the hottest section first — at the bottom — so bed adhesion gets the strongest bond.

What retraction settings should I test?

Direct drive: distance 0.2 to 1.5 mm in 0.2–0.3 mm steps, speed 20–45 mm/s. Bowden: distance 2 to 7 mm in 1 mm steps, speed 25–60 mm/s. Test distance first at a fixed speed, then speed at the best distance. Find the lowest values that eliminate strings between the pillars; more retraction than needed causes clogs and blobs.

Will this work on my printer?

It produces standard G-code (G0/G1, M104, M140, M106, M83) that Marlin, Klipper, RepRapFirmware and their derivatives all accept. The built-in start sequence homes and heats; if your printer needs a custom start (Klipper PRINT_START macros, purge lines, bed mesh loading), paste it in the custom start G-code box. Always preview the file in your slicer or a G-code viewer before printing.

Why not just use a slicer plugin?

Plugins are slicer-specific, break between versions, and need post-processing scripts that many people find fiddly. A generated file is the same test every time, works with any slicer or none, and you can keep it and reprint it for every new spool.

Last reviewed September 7, 2026. Spotted an error or want another calculator? Tell us.