A slicer is the translator between your 3D model and your printer. It cuts a digital mesh into hundreds of thin layers, then converts each layer into a G-code file: a plain-text list of movements, temperatures, and extrusion commands your printer firmware can execute. Understanding that conversion is the fastest way to fix bad prints, because nearly every print defect traces back to a slicer decision.
Quick Takeaways
- A slicer does four jobs: it slices the mesh into layers, generates toolpaths, calculates extrusion volume, and writes G-code.
- Layer height, wall count, infill, and speed control roughly 90% of print quality, strength, and time.
- G-code is readable. Commands like
G1 X50 Y50 E2.5 F1800are simple once you know the syntax. - Slicer settings are not interchangeable with firmware settings. Slicers plan the path; Marlin or Klipper executes it.
| Pipeline Stage | Input | Output |
|---|---|---|
| 1. Model import | STL / 3MF / OBJ | Triangle mesh |
| 2. Slicing | Mesh + layer height | 2D contours per layer |
| 3. Toolpath generation | Contours + settings | Perimeters, infill, supports |
| 4. G-code export | Toolpaths + printer profile | .gcode file |
Step 1: Importing the Model (STL, 3MF, OBJ)
Slicers read a triangle mesh: a surface built from thousands of small triangles. Each triangle stores three vertices and a facing direction (the normal), which tells the slicer which side is “inside” the part.
| Format | Stores | Best For | Drawback |
|---|---|---|---|
| STL | Geometry only | Universal compatibility | No units, color, or settings |
| 3MF | Geometry, units, colors, slicer settings | Modern workflows, multi-material | Slightly less universal |
| OBJ | Geometry, color, textures | Multi-color models | Larger files, rarely needed |
| STEP | True CAD surfaces | Precision engineering | Needs conversion to mesh first |
Mesh quality matters. A slicer cannot reliably slice a model with holes, flipped normals, or self-intersections. Most slicers flag these as “non-manifold” errors. Fix them with the slicer’s built-in repair tool or a utility such as Meshmixer or the Windows 3D Builder.
STL resolution also sets a hard limit. A curved surface exported with coarse triangles prints as visible facets, no matter how fine your layer height is. Export STLs with a chord tolerance of 0.01 to 0.05 mm for smooth curves.
Step 2: Slicing the Mesh Into Layers
The slicer places a horizontal plane at each layer height and calculates where that plane intersects the mesh. Every intersection produces a closed 2D outline. Stack those outlines and you have the part.
Layer Height
Layer height is the single biggest quality-versus-time tradeoff.
| Layer Height | Typical Use | Detail | Print Time (relative) |
|---|---|---|---|
| 0.08 to 0.12 mm | Miniatures, visual prototypes | Excellent | 2.5x to 3x |
| 0.16 to 0.20 mm | General-purpose, 0.4 mm nozzle default | Good | 1x (baseline) |
| 0.24 to 0.28 mm | Fast drafts, functional parts | Moderate | 0.6x to 0.7x |
| 0.32 to 0.40 mm | Large utility prints | Visible lines | 0.4x to 0.5x |
Rule of thumb: keep layer height between 25% and 75% of nozzle diameter. On a 0.4 mm nozzle, that means 0.10 to 0.30 mm.
First Layer
The first layer gets special treatment. Slicers print it slower (often 15 to 25 mm/s), thicker (0.2 to 0.3 mm), and wider (110% to 120% line width) to maximize bed adhesion.
Adaptive and Variable Layer Height
Modern slicers (PrusaSlicer, OrcaSlicer, Cura, Bambu Studio) can vary layer height across the part. Flat vertical sections use thick layers, while curves and fine details use thin ones. Expect 20% to 40% time savings on organic shapes with no visible quality loss.
Step 3: Generating Toolpaths
Once the slicer has 2D outlines, it fills them in. This is where most of your settings do their work.
Perimeters (Walls)
Perimeters trace the outline of each layer. They determine surface finish and most of a part’s strength.
- Wall count: 2 walls for decorative parts, 3 to 4 walls for functional parts.
- Line width: typically 100% to 120% of nozzle diameter (0.4 to 0.48 mm on a 0.4 mm nozzle).
- Wall order: inner-first improves strength; outer-first improves dimensional accuracy.
- Seam position: the point where each loop starts and ends. Aligned seams create a visible vertical line. Randomized or “back” placement hides it.
Infill
Infill is the internal structure. More infill adds weight, time, and material cost, but strength gains flatten out quickly past 30% to 40%.
| Infill Pattern | Strength | Speed | Material Use | Best For |
|---|---|---|---|---|
| Grid | Moderate | Fast | Low | Basic prints |
| Gyroid | High, isotropic | Moderate | Moderate | Functional parts, flexible filaments |
| Cubic | High | Fast | Moderate | General-purpose strength |
| Lightning | Low | Very fast | Very low | Display models |
| Rectilinear / Lines | Directional | Very fast | Low | Flat-top support |
| Honeycomb | High | Slow | High | Compression loads |
Practical infill targets:
- 10% to 15%: display pieces, figurines
- 20% to 30%: everyday functional parts
- 40% to 60%: load-bearing brackets, gears
- 100%: rarely worth it; adding walls is more efficient
Top and Bottom Layers
Solid skin layers cap the infill. Calculate the count so the skin thickness is at least 0.8 mm. At 0.2 mm layers, that means 4 top layers and 3 to 4 bottom layers. Too few top layers cause “pillowing,” where the top surface sags between infill lines.
Supports
Where geometry overhangs beyond a threshold (default 45 to 50 degrees from vertical), the slicer generates support structures.
| Support Type | Removal | Surface Quality | Material Waste |
|---|---|---|---|
| Normal / Grid | Moderate | Fair | Moderate |
| Tree / Organic | Easy | Good | Low |
| Interface layers | Easy | Best | Moderate |
| Soluble (PVA, BVOH) | Dissolve in water | Excellent | High (dual-extruder) |
Set Z distance between support and part to roughly one layer height (0.2 mm) for easy peeling. Use tree supports by default for organic shapes since they touch the model at fewer points.
Bridging, Retractions, and Travel Moves
- Bridging: slicers detect unsupported spans and slow the print while boosting cooling fan speed to 100%.
- Retraction: between separate features, the extruder pulls filament back to prevent stringing. Typical values: 0.4 to 1.0 mm at 25 to 45 mm/s for direct drive, 4 to 6 mm for Bowden setups.
- Z-hop: lifts the nozzle during travel (0.2 to 0.4 mm) to avoid knocking over finished features. It can also add stringing, so use it only when needed.
Step 4: Calculating Extrusion
The slicer must decide how much plastic to push for every millimeter of movement. It does this geometrically.
Extrusion volume per move = line width x layer height x travel length
The extruder motor then needs the filament length that equals that volume:
Filament length (E) = volume / (π x (filament diameter / 2)²)
For a 1.75 mm filament, cross-sectional area is about 2.405 mm². A 10 mm move at 0.45 mm line width and 0.2 mm layer height needs 0.9 mm³ of plastic, which is about 0.374 mm of filament.
This is why flow rate and filament diameter calibration matter. A 3% error in measured filament diameter produces a roughly 6% error in extruded volume, since area scales with the square of diameter.
Step 5: Exporting G-Code
G-code is a text file of commands. Each line tells the printer to move, heat, extrude, or run a macro. Open any .gcode file in a text editor and you will see this structure.
Anatomy of a Start Sequence
M140 S60 ; Set bed temp to 60C (no wait)
M104 S200 ; Set nozzle temp to 200C (no wait)
G28 ; Home all axes
M190 S60 ; Wait for bed to reach 60C
M109 S200 ; Wait for nozzle to reach 200C
G92 E0 ; Reset extruder position to zero
G1 Z2.0 F3000 ; Lift nozzle 2 mm
G1 X10 Y20 Z0.28 F5000 ; Move to purge line start
G1 X10 Y200 Z0.28 E15 F1500 ; Draw purge line
G92 E0 ; Reset extruder again
Anatomy of a Print Move
;LAYER:0
;TYPE:WALL-OUTER
G1 F1800 X60.0 Y60.0 E0.5
G1 X80.0 Y60.0 E1.4
G1 X80.0 Y80.0 E2.3
G1is a linear move.X,Y,Zare target coordinates in mm.Eis the extruder position (filament length pushed).Fis feed rate in mm/min (1800 = 30 mm/s).- Comments after
;are ignored by the printer but help debugging.
Core G-Code Commands
| Command | Function | Example |
|---|---|---|
G0 / G1 |
Linear move (travel / print) | G1 X100 Y50 E3 F1800 |
G28 |
Home axes | G28 |
G29 |
Auto bed leveling | G29 |
G90 / G91 |
Absolute / relative positioning | G90 |
G92 |
Set current position | G92 E0 |
M104 / M109 |
Set nozzle temp / wait | M109 S210 |
M140 / M190 |
Set bed temp / wait | M190 S60 |
M106 / M107 |
Fan on / off | M106 S255 |
M82 / M83 |
Absolute / relative extrusion | M83 |
M84 |
Disable steppers | M84 |
Custom Start G-Code for Klipper
Klipper users typically call a macro instead of raw commands. Slicers pass temperatures in as variables:
START_PRINT BED_TEMP=[first_layer_bed_temperature] EXTRUDER_TEMP=[first_layer_temperature]
The matching macro in printer.cfg:
[gcode_macro START_PRINT]
gcode:
{% set BED = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER = params.EXTRUDER_TEMP|default(200)|float %}
M140 S{BED}
M104 S{EXTRUDER}
G28
M190 S{BED}
M109 S{EXTRUDER}
G92 E0
G1 Z2 F3000
Keeping logic in the firmware macro means you change behavior once, not in every slicer profile.
Slicer Settings That Change the G-Code Most
| Setting | Typical Range (0.4 mm nozzle, PLA) | Effect on G-Code | Effect on Print |
|---|---|---|---|
| Outer wall speed | 40 to 60 mm/s | Lower F on perimeter moves |
Cleaner surfaces |
| Infill speed | 80 to 200 mm/s | Higher F on infill moves |
Faster, rougher |
| Acceleration | 500 to 5000 mm/s² | M204 commands |
Ringing vs. time |
| Nozzle temp | 190 to 220 °C | M104 / M109 values |
Layer bonding, stringing |
| Cooling fan | 0% to 100% | M106 values |
Overhang quality, strength |
| Flow ratio | 95% to 105% | Scales every E value |
Wall size accuracy |
Popular Slicers Compared
| Slicer | Cost | Strengths | Best For |
|---|---|---|---|
| UltiMaker Cura | Free | Huge profile library, plugins | Beginners, Creality printers |
| PrusaSlicer | Free | Clean UI, strong supports, variable layer height | Prusa users, tuning |
| OrcaSlicer | Free | Calibration tools, fast updates, broad printer support | Klipper and enthusiasts |
| Bambu Studio | Free | Tight Bambu Lab integration | Bambu printers |
| Simplify3D | Paid | Granular process control | Legacy workflows |
| Kiri:Moto | Free (web) | Browser-based, CAM-capable | Quick slicing |
Real-World Use Cases
Functional bracket (PETG, 0.2 mm layers). Use 4 walls, 40% gyroid infill, 5 top layers. Orient the part so layer lines run perpendicular to the main load. This single decision often matters more than infill percentage.
Display miniature (resin-like detail on FDM). Use a 0.2 mm nozzle, 0.08 mm layers, tree supports with fine interface, and outer wall speed of 25 mm/s. Expect print times of many hours but crisp detail.
Rapid prototype enclosure. Use 0.28 mm layers, 2 walls, 10% lightning infill, 120 mm/s infill speed. A fit-check prototype that would take 9 hours at 0.12 mm finishes in about 3.
Vase-mode decorative piece. Enable spiral vase mode: the slicer prints a single continuous wall with no seam, no infill, and constant Z rise. Prints in minutes and produces a flawless surface.
Flexible TPU gasket. Reduce speed to 20 to 30 mm/s, disable or minimize retraction, and use gyroid infill for consistent flex.
Common Slicing Mistakes and Fixes
| Problem | Likely Slicer Cause | Fix |
|---|---|---|
| Stringing | Retraction too low, temp too high | Raise retraction 0.5 mm, drop temp 5 °C |
| Gaps in top surface | Too few top layers or low infill | Add top layers, raise infill to 15%+ |
| Weak layer bonding | Cooling too high, temp too low | Reduce fan, raise temp 5 to 10 °C |
| Rough overhangs | Fan too low, speed too high | Fan 100%, slow overhang speed |
| Visible seam line | Aligned seam position | Use “back” or “random” seam |
| Dimensional error | Flow ratio off | Calibrate flow with a single-wall cube |
| Elephant’s foot | First layer too squished | Raise Z offset slightly, add elephant foot compensation |
Reading G-Code Yourself
Previewing G-code before printing catches errors that a model view hides. Every major slicer includes a layer-by-layer preview that color-codes feature types. Scrub through the layers and check for:
- Unsupported bridges or islands floating in mid-air
- Gaps where thin walls fell below minimum width
- Excess travel moves that signal bad print order
- Seam clustering on visible faces
For deeper inspection, open the file in a G-code viewer such as Fluidd’s or Mainsail’s built-in viewer, or the standalone NCViewer. Search for ;TYPE: comments to jump between features.
FAQ
What is the difference between a slicer and firmware?
The slicer plans the print: it decides every path, temperature, and speed before the job starts. The firmware (Marlin, Klipper, RepRapFirmware) executes those commands in real time, handling motor timing, acceleration, and temperature control. The slicer writes the script; the firmware performs it.
Can I edit G-code manually?
Yes. G-code is plain text, so any editor works. Common manual edits include inserting M600 for a filament change at a specific layer, adding pauses with M0, or adjusting a temperature mid-print. Always keep a backup, since one wrong coordinate can crash the nozzle into the bed.
Why does the same model print differently in different slicers?
Each slicer uses its own algorithms for seam placement, infill generation, support geometry, and path ordering. Default profiles also differ in speed, acceleration, and cooling. Identical settings on paper still produce different G-code, so recalibrate flow and retraction when you switch.
Is G-code the same for every 3D printer?
No. The core commands (G1, M104, G28) are widely shared, but start and end scripts, bed leveling calls, and macros vary by firmware and printer. Always select the correct printer profile in your slicer. Some machines, like Bambu Lab printers, also use proprietary extensions packaged in .gcode.3mf files.




