How to Tune Marlin Linear Advance

You’ve calibrated your e-steps, tuned your flow rate, and dialed in your temperatures. Your first layers look like glass. But the moment you try to speed up your print, your corners start bulging, your sharp edges look like rounded blobs, and layer seams become painfully obvious.
Sound familiar? It’s one of the most frustrating walls to hit in 3D printing.
The good news is that you don't need expensive new hardware to fix this. You just need to teach your printer's brain how to handle the physics of melting plastic. This is exactly what Marlin Linear Advance does. It is easily one of the most powerful—and most misunderstood—tools for optimizing your print quality.
Let's demystify Linear Advance, calibrate your K-factor, and get you printing faster with razor-sharp precision.
What Actually is Linear Advance?
To understand Linear Advance, you have to understand the "spring" effect.
When your extruder gear pushes filament into the hotend, the plastic doesn't melt and flow out of the nozzle instantaneously. Solid filament is slightly flexible. As the extruder quickly pushes it, the filament compresses momentarily against the pressure of the nozzle before it actually begins to flow.
The opposite happens when your printer slows down for a corner. The extruder gear might stop pushing, but because the filament inside the tube is compressed, it acts like a loaded spring. It wants to decompress, so plastic keeps oozing out of the nozzle even though the extruder motor has stopped.
This lag means your X and Y motors are perfectly in sync, but your plastic flow is constantly a step behind. The result? Under-extrusion when accelerating, and over-extrusion (bulging corners) when slowing down.

Linear advance fixes this by decoupling the extruder motor from the X/Y axes. It calculates exactly how much pressure is building up and intentionally speeds up or slows down the extruder motor to maintain perfectly even nozzle pressure at all times.
Direct Drive vs. Bowden Setups
Linear advance can be used on almost any machine, but the results you see will depend heavily on your hardware.
Because Bowden setups use a long PTFE tube to guide the filament, there is a massive amount of room for the filament to bend, flex, and compress. Therefore, Bowden printers see a dramatic night-and-day improvement from Linear Advance. Direct Drive machines have a very short path to the melt zone, so their "spring" effect is much smaller—but tuning Linear Advance will still provide meaningful improvements.
| Setup Type | Filament Path | Typical K-Factor (Marlin v1.5) | Expected Improvement |
|---|---|---|---|
| Direct Drive | Very Short | 0.01 - 0.05 | Moderate (sharper corners) |
| Standard Bowden | Long (PTFE Tube) | 0.05 - 0.15 | Massive (fixes heavy bulging) |
Older guides written for Marlin 1.1.9 reference Linear Advance v1.0, which used massive K-factors (like 1.0 to 2.0). Modern Marlin 2.x firmware uses Linear Advance v1.5, which relies on much smaller values (typically under 0.2). Always use v1.5 values on modern firmware!
Step-by-Step: Calibrating Your K-Factor
The number your printer uses to calculate this pressure compensation is called the K-Factor. Because every filament is different (PLA is stiff, TPU is basically a rubber band), you need to find the specific K-Factor for the different material types you print with.
-
Check your firmware: Ensure your printer is running Marlin 2.0.6 or higher with
LIN_ADVANCEenabled in yourConfiguration_adv.hfile. (If you are using stock firmware on a newer printer, it is likely already enabled). - Clean your nozzle: A partial clog will ruin this test.
- Level your bed: The calibration test relies on perfect first-layer adhesion.
Before testing, you must go into your slicer (Cura, PrusaSlicer, etc.) and turn off settings like "Coasting", "Wipe", or "Pressure Advance". These are the slicer's software attempts to fix bulging corners. If you leave them on while hardware Linear Advance is running, they will fight each other and cause severe under-extrusion.
1. Generate the Test G-Code
To determine your K-factor, head over to the official Marlin K-factor Calibration Pattern Generator.
- Input your standard print settings (Nozzle temperature, bed temperature, layer height, and retraction). Use the exact settings you normally slice with.
- For the Starting Value for K, use
0. - For the Ending Value for K, use
0.2(for Bowden) or0.1(for Direct Drive). - Set the K-factor Stepping to
0.01to ensure you get a highly accurate result. - Click "Generate G-code" and save the file to your SD card.
Because you will be visually inspecting lines that are only 0.4mm wide, use a filament color that heavily contrasts with your build plate. If you have a black PEI sheet, use stark white or bright yellow PLA. Avoid dark or translucent filaments for this test.
2. Print and Read the Pattern
Run the G-code on your printer. It will print a series of straight lines.
Notice how the printer behaves: it will start printing a line slowly, suddenly speed up in the middle, and then rapidly slow down at the end. The only difference between each line is the K-factor applied to it. The numbers printed next to the lines tell you which K-factor was used.

How to pick the right line:
Look at the points where the print speed changes (the transition from slow to fast, and fast to slow).
- If the K-factor is too low, you will see thick blobs where the speed changes.
- If the K-factor is too high, you will see severe thinning or even empty gaps where the extruder pulled back too aggressively.
- The best line will look uniform in width from start to finish.
If none of them look perfect, pick the one that looks the least terrible, write down that number, and you can run a second test with a tighter range around that number.
Saving Your Settings
Once you have your golden number (let's say it was 0.06), you need to tell your printer to use it. You have two ways to do this:
Method 1: Slicer Start G-Code (Recommended)
Because PLA, PETG, and ABS all have different flexibilities, they need different K-factors. The easiest way to manage this is to save the value in your slicer's material profile.
Add the M900 command to your material's starting G-code:
M900 K0.06
Method 2: Save to EEPROM (Best if you only print one material)
If you exclusively print with one brand of PLA, you can lock it into your printer's memory via a terminal (like Pronterface or OctoPrint) using these commands:
M900 K0.06
M500
A common mistake is calibrating Linear Advance perfectly for rigid PLA, and then switching to flexible PETG or TPU without changing the K-factor. Flexible filaments require entirely different pressure compensation. If you change filament types, run the calibration test again.
- Linear Advance synchronizes extruder pressure with X/Y movements, fixing bulging corners and layer seam blobs.
- Bowden setups benefit the most, but Direct Drive systems still see noticeable improvements.
- You must disable slicer-based pressure tricks (like Coasting) before using firmware Linear Advance.
- Your K-Factor is specific to the filament type; rigid filaments and flexible filaments will have different values.
Do I need to re-calibrate my K-factor if I change my nozzle size?
Yes. Changing the nozzle diameter, nozzle material (e.g., brass to hardened steel), or printing temperatures will alter the melt zone dynamics and fluid resistance. You should run a quick K-factor test anytime you change hotend hardware.
Why is my extruder making a clicking or rattling sound after enabling Linear Advance?
Because Linear Advance requires the extruder motor to rapidly reverse and accelerate to manage pressure, it works the stepper motor much harder. Violent clicking usually means your K-factor is set too high, or your extruder stepper current is set too low to handle the rapid movements.
Can I use Linear Advance with TPU (flexible filament)?
You can, but the K-factor will be significantly higher than PLA because TPU compresses so much inside the tube. For extremely flexible TPU on long Bowden setups, Linear Advance might actually cause the filament to buckle in the extruder gear, so it is often best left disabled (K=0) for ultra-soft filaments unless you have a Direct Drive setup.