Projects »

Cutting DIY Solder Paste Stencils for PCBs

Inkscape extension for creating low cost solder paste stencils. Laser-cutting or bladed Silhouette machine

This free extension for Inkscape makes it easy to create a solder paste stencil for reflow soldering SMT/SMD components to a PCB.

Commercial PCB stencils are laser cut from steel, but for prototypes it's quicker and cheaper to cut your own stencil with a hobbyist-grade laser cutter or a bladed Silhouette machine. I've found 200 gsm vellum paper works well with solder paste, cuts cleanly, very cheap, can be cleaned with isopropanol (isopropyl) and reused to paste up to 10 PCBs.

It can also be useful to create a one-off stencil to repair just part of a PCB, such as a chip or socket that needs to be removed and re-pasted.

PCB with vellum stencil

The extension only works with the open-source KiCad EDA, as it relies on the export SVG feature. If your PCB was designed with other software, use KiCad to import your paste file (Gerber format, .gbr or .GTP) and then export it as SVG.

Download the latest Inkscape and KiCad EDA packages.

How to install

To manually install this extension, download and unpack the archive file. Copy the pcb_stencil folder to the location listed by the Inkscape menu:

Edit > Preferences > System: User extensions

For Windows users this will be something like:

%APPDATA%\inkscape\extensions

Restart Inkscape and the new extension will be available from the menu:

Extensions > Modify Path > PCB Solder Stencil

Export from KiCad

First export the solder paste layer from your design in KiCad's PCBNew, with just the F.Paste layer ticked:

File > Export > SVG...

kicad screenshot

For PCBs with components on both sides you could export the F.Paste and B.Paste layers separately, then merge them into a single stencil. Or just cut as two stencils.

KiCad 9 has removed export SVG from the menu, but the extension archive includes a Jobset file kicad9_export_svg.kicad_jobset which replicates that missing option.

Using the extension

Load the exported solder paste layer into Inkscape, and open the extension from the menu:

Extensions > Modify Path > PCB Solder Stencil

extension window   converted stencil

By default the extension will Annotate the stencil by engraving the filename & export date, but edit this for as much or little text as required. A 'stick' typeface is used for faster engraving.

If your PCB has fine pitch pads (under 0.8mm pitch) then you may need to experiment with the Shrink pads and Pad spacing settings, depending on your laser and the stencil material. I've managed useable vellum stencils down to 0.5mm pitch, and 0805, 0603 or 0402 components certainly won't be a problem. Shrinking the pads means less paste gets onto each pad, while pad spacing controls the minimum gap between pads, so the gaps stay intact to block paste from bridging the pads.

Add Border simply adds space around the stencil to make it easier to handle. eg, if you are taping it down onto a PCB.

Clicking "Convert" will create the stencil. The cutting order of the pads is optimised to reduce the laser head travel. The colours are red for engraved text, then the green pads are cut, and finally the blue outer cut releases the finished stencil.

Laser cutting the stencil

Send the finished stencil to your laser cutter like any other job. I use my own extension for laser cutting with LaserGRBL which exports to open-source software for controlling the laser cutter.

As with any material, you'll need to experiment to find the ideal cutting & engraving settings for your particular laser. On my 10W diode laser I engrave 1 pass 800 mm/min @ 40% power and cut 2 passes 650 mm/min @ 40% for 200 gsm white vellum, with air assist. Vellum doesn't really char so it can be hard to make the engraved text visible, without setting the laser so high that it just cuts clean through.

In the UK I can recommend Jackdaw Express who sell sheets of suitable vellum.

Laser stencil materials:

Videos:

solder paste stencils: steel, vellum and Mylar
Stencils in steel, vellum and Mylar

Cutting stencils on a Silhouette Cameo or Cricut Maker

Crafting cutters that use a physical blade (instead of a laser) can also be used with a fine blade to make stencils. It is possible to get useable results down to 0.5mm pitch.

There is an Inkscape extension to drive Silhouette vinyl cutters (e.g. Cameo, Portrait, Curio series).

Most materials can be used, including low cost sheets of vinyl / PVC. See SMD Solder Paste Stencil Creation with Silhouette Cameo using Mylar film, and Cutting SMD stencils with Silhouette Cameo vinyl cutter using a "plastic sheet".

Other DIY stencil options

Don't have access to a laser cutter or Silhouette? Some other creative options include DIY home-made SMT metal stencil by acid-etching old aluminium drinks cans, or Creating Mylar Solder Stencils With A CNC Machine.

Optimising the cutting order

KiCad exports cut in a very inefficient order, with the laser head travelling unnecessarily long distances. The extension automatically re-orders the pads to save a handful of seconds during cutting. This section is only for users interested in what it's doing under the hood.

kicad cutting order   optimised cutting order
KiCad's cutting order   Optimised cutting order

Computer scientists (and mathematicians) will recognise finding the best order between pads as the classic "Travelling Salesperson Problem", for which finding the absolute best solution is known to be NP-hard1. Hence the extension uses a greedy heuristic instead: to find a good (but not necessarily the best) solution within a second or two.

There are 3 algorithms included in the extension, and the curious can change the default by editing the start of the pcb_stencil.py file:

  1. Nearest Neighbour, simple and very fast for small stencils, very low memory usage, but less optimal cutting order
  2. NN then 2-Opt Local Search (default), finds better cutting orders than NN alone, but slower and higher memory usage. Often "good enough" if under 5000 solder pads
  3. NN then Parallel 2-Opt, runs on multicore CPUs, faster and lower memory usage if over 1000 solder pads

For example the default algorithm only takes 1.6 seconds and 5 MB memory for a large stencil with 1600 solder pads on an average PC, but this rises exponentially to 4 minutes and 275 MB with 12000 pads. In practice you'd never cut a stencil with so many pads, but it's still an interesting problem that has many other practical applications.

Reducible made a excellent video on the subject: The Traveling Salesperson Problem: When Good Enough Beats Perfect.

1NP-hard problems can take days or even years to brute-force calculate. e.g., stencil with 1600 pads has 3.9 × 106039 possible cutting orders.

Changelog

v0.35 09/May/2025
  • KiCad 9 now supported using Jobset file to replicate the missing export SVG menu option
  • Improved pad resizing for laser kerf. No longer uses Transform() or stroke-width bodge
  • New Pad spacing feature, useful for fine pitch parts. Documented in README
  • Reduced size of output document with shared SVG styles
  • Added unit tests for use with pytest (not included in standard archive)
v0.30 27/Apr/2025
  • Reduced travel distance by using 2-Opt Local Search tsp_nn_2opt.py, after the Nearest Neighbour phase
    added experimental parallel-processing (multicore) version tsp_nn_2opt_parallel.py, for large PCBs (over 1000 pads)
    documented in README with diagrams
  • NN phase of cutting order (TSP) algorithms now 3× faster by quickly excluding distant points
  • 3× faster at opening the extension for large stencils. Much faster when user is editing the border size
  • BUG crashed if annotated text was empty or had an empty line
  • Documented different stencil materials in README, with videos
  • Documented using bladed cutters in README, with videos
v0.20 16/Apr/2025
  • Refactored TSP code without numpy, now 14× faster at optimising the cutting order
    slight reduction in travel distance by using center of each solder pad
    separated cutting order (TSP) code into tsp_neighbour.py
  • Separated Hershey (stick) font code into hershey.py
  • Inkscape v1.2 reads board name+date from SVG
  • Added KiCad v6 and v7 support, not just v8 export SVG
  • more options supported: Color Mode, Black and white Mode, Color themes, Current page size, Board area only
  • Keeps pad stroke-width at 0.1mm, even after scaling for laser kerf
v0.10 05/Apr/2025
  • Initial release

Future ideas

Any feedback, suggestions or bug reports is VERY welcome. Below are some ideas, but I'll wait for feedback before working on them:

  1. Import Gerber F_Paste.gbr files so works for all EDA packages, not only KiCad
    (separate extension to import any Gerber file into Inkscape, not just solder paste layers)
  2. Setting to position the annotated text as left/centre/right, top/bottom of stencil
  3. Keep pad stroke-width at 0.1mm, even after scaling for laser kerf
  4. Add pad shrink & spacing feature for pads rotated 45°
  5. Does it need inches/metric setting, or does everyone use mm for laser cutting?
  6. Can we support KiCad v9, missing export SVG feature?
  7. Add language translations. Please contact me if you'd like to contribute

Fb Share this on Facebook
Nikki Smith, July 2025.