Skip to main content

kistitch

kistitch places ground return vias, pad vias and pour stitching vias on the board open in KiCad's PCB editor, and shows heatmaps of where vias are missing. Every run is checked with KiCad's DRC before kistitch commits it to the board.

Before: kistitch returnvia --check --overlay After: kistitch returnvia --overlay
Return distance heatmap on F.Cu before placing return vias, with many rings around unserved vias Return distance heatmap on F.Cu after placing return vias, with some rings left

The return distance heatmap on F.Cu of a four-layer board, before and after placing return vias. Each pink ring marks a via or pad end with no ground return within 1.5 mm through its reference plane. The rings left after the run mark the vias and pads the planner couldn't serve; those you fix by hand.

Why

At high frequencies, the return current of a signal flows on the nearest reference plane, directly beneath the trace. In the figures below, forward current is blue and return current red.

A Z-shaped trace from a driver to a sink over a ground plane; the return current on the plane follows the trace back to the driver

On a trace over a plane, the return current follows the trace like this from about 100 kHz up. A digital signal's bandwidth is about 0.35/t_r, so a 1 ns edge reaches 350 MHz whatever the clock rate: modern edge rates make every digital signal high frequency in this sense.

A four-layer board with translucent ground planes on L2 and L3: the signal runs on L1, through a via and on along L4; its return current follows it on L3, jumps to L2 through a ground via next to the signal via, and follows the L1 trace back to the driver

A signal going through a via from L1 to L4 changes its reference plane from L2 to L3. The return current follows the trace on each plane and crosses between the planes through a ground via next to the signal via. Without a via nearby, the return current spreads out across the planes at the layer transition, and the larger current loop radiates a magnetic field: noise emission.

Howard Johnson's "Short-Term Impedance of Planes" covers the physics in more depth.

For good return paths, kistitch recommends a solid ground plane next to every signal layer. On four layers, that is SIG+PWR / GND / GND / SIG+PWR: power is routed as tracks on the outer layers, or poured as copper between the traces.

Both ground and power then need stitching to the same nets on the other layers:

  • Ground stitching makes the two ground planes act as one reference.
  • With orthogonal routing, for example vertical on L1 and horizontal on L4, each outer-layer power pour breaks into fingers. Stitching ties the pours of the two layers into one mesh, which lowers the impedance between the loads and the bypass capacitors on either layer.
  • kistitch's automatic power stitching, which brings every point of a pour within 10 mm of a via, is a baseline. You usually add vias by hand where the heatmap shows gaps.

Stitching by hand is tedious, and areas with poor connectivity are hard to spot. kistitch places the vias, and its heatmaps show what is left.

What it does

  • Pad vias give an SMD pad a via and a short stub track into its net's plane or pour on another layer. Only pads of nets with zones on two or more copper layers get one, and a pad that already reaches a same-net via or through-hole pad within 1 mm is skipped.
  • Pour stitching places vias so every point of a net's pours lies within a distance of a via, measured through the copper rather than in a straight line. Ground nets are stitched at 3 mm, power and other nets at 10 mm. Only nets with pours on two or more copper layers are stitched.
  • Return vias give every via on a non-ground net a ground via within 1.5 mm, through each reference plane it uses.
  • Heatmaps show return distance and pour coverage, placed on the board as reference images or written to a file, for checking a layout and placing vias by hand.
Before: kistitch pourstitch --power --check --overlay After: kistitch pourstitch --power --overlay
Power pour coverage on F.Cu before stitching, with pink areas beyond 10 mm Power pour coverage on F.Cu after placing stitching vias

Power pour coverage on F.Cu. Pink copper is more than 10 mm from a stitching via, measured through the copper.

Before: kistitch pourstitch --check --overlay After: kistitch pourstitch --overlay
Ground plane coverage on In1.Cu before stitching, with pink gaps between vias Ground plane coverage on In1.Cu after placing stitching vias

Ground plane coverage on In1.Cu, after power stitching and return vias. Pink copper is more than 3 mm from a stitching via. The pink left after the run, here next to the through-hole pads, is copper where no via fits.

Install

kistitch installs from KiCad's Plugin and Content Manager:

  1. In the Plugin and Content Manager, open Manage repositories and add https://github.com/hatlabs/kistitch/releases/download/pcm/repository.json.
  2. Choose kistitch in the repository list at the top of the window; adding a repository does not show it. Install kistitch from the Plugins tab and apply the changes.
  3. Open a board in the PCB editor and press the kistitch button in the toolbar.

kistitch runs outside KiCad. The first press of the button offers to install uv and kistitch with its panel, which needs an internet connection, and installs nothing until you agree. Later presses open the panel, or bring it to the front.

kistitch needs KiCad 10 and kicad-python 0.8 or later.

Without the plugin manager

kistitch is on PyPI. Name Python 3.14 when installing it: uv otherwise picks the newest Python, and one of kistitch's dependencies has no packages for 3.15 yet:

uv tool install --python 3.14 'kistitch[gui]'

Without the gui extra you get only the command line.

Before the first run

  • Enable the KiCad API in Preferences > Plugins > Enable KiCad API. Only one KiCad instance can serve the API at a time, so close other KiCad windows if kistitch can't find the open board.
  • Save rule and netclass changes before a run. The DRC check reads the saved .kicad_pro and .kicad_dru from disk. The board itself is read from the editor, unsaved changes included.
  • Set the zones' Remove islands to Never. KiCad then keeps unconnected islands in the fill, and kistitch can place vias in them to connect them. Islands it can't stitch show as isolated copper in DRC.

Using it

The kistitch panel on the HALMET board, with GND and GND1 as ground nets, after a power stitching heatmap

The panel runs on the board open in the PCB editor. Ground nets starts with the detected ground nets: the nets with zones on two or more inner layers. Each step has Place, and all but the first have Heatmap, which places the step's heatmap on the board without placing vias. Run the steps in order:

  1. Pad vias. Place, then look at the circles on User.Eco2: each marks a pad where no via fits. Adjust those pads by hand.
  2. Power stitching. Place, then Heatmap. Add vias by hand at the ends of power pours that are still pink, and where a pour carries high current.
  3. Return vias. Place. It gives a return to every via and through-hole pad on a non-ground net, the power stitching vias included. Fix the vias and pads it circles by hand, then run Heatmap to confirm none is left.
  4. Ground stitching. Place. It counts the return vias as ground stitches, so it only fills the gaps they leave. Around an RF section, add ground vias by hand: 3 mm is not dense enough there (see Pour stitching).

Power stitching goes before return vias because its vias need returns, and ground stitching goes last because the return vias count towards it.

Finish with Heatmap on Power stitching and on Return vias. Steps 3 and 4 place ground vias inside the outer-layer power pours, which can lengthen paths through power fingers. After later hand edits, run both checks again.

Clean up has Clear markers and heatmaps, and Remove vias…, which counts the stitching vias on the chosen nets and asks before removing them.

The panel describes each field, option and status line.

What a run changes

  • A run commits its vias as one undo step. With refills on, it then refills the zones as a second step, so undoing a placement takes two Ctrl+Z: one for the refill and one for the commit. With refills off, it takes one. A Heatmap run after the placement adds undo steps of its own, which come off first.
  • Markers for spots that need attention go on User.Eco2. Each Place, and each Heatmap, removes every shape on User.Eco2, hand-drawn ones included, before adding its own.
  • Before committing, kistitch runs KiCad's DRC on a copy of the board with the planned vias, and drops vias that cause new violations.
  • Other nets' pours are not obstacles, so a via can cut a narrow neck of another net's pour. The run commits anyway and marks each such cut with a square on User.Eco2 for fixing by hand.
  • Heatmaps go on User.1 to User.4 by default, one per copper layer, as reference images. Clear markers and heatmaps removes them. The panel always uses those four layers, so its Heatmap fails on a board with more than four copper layers; there, run kistitch <command> --check --overlay --overlay-layers LAYER ... with one user layer per copper layer, or --check --render PATH.

Remove vias, or kistitch clear --vias, removes every unlocked via that touches a pour of its own net and that no track or pad ties down, including vias you placed by hand. To keep such a via, connect it with a short track or lock it.

Limits

  • Return vias assume that the plane next to each signal layer is ground. On a SIG-GND-PWR-SIG board, B.Cu's real reference is the power plane on In2. With no ground zone on In2, kistitch measures B.Cu via ends against the ground plane on In1 instead. See Return vias.
  • The planners keep fixed clearances, such as 0.3 mm to other-net copper and 0.5 mm from the board edge, listed in Markers and DRC. They don't read custom design rules; only the DRC check enforces those.
  • Placed vias can't be grouped, because KiCad 10 doesn't create groups through its API.

How it works

Return vias. For each end of a signal via, kistitch takes the nearest other copper layer with a ground zone at the via as its reference plane, and measures the distance through that plane's ground fill, from the via's drill wall to the drill wall of the nearest ground via or through-hole pad. A signal through-hole pad connected on two or more layers is measured, reported and given a return via like a via; a pad or via connected on fewer layers is exempt. Ground through-hole pads are returns. For a via or pad beyond the limit, it tries spots on rings around it, nearest first, and takes the first with full clearance that serves every unserved end.

Pour stitching. kistitch rasterises each net's pours at 0.1 mm, places vias on a square lattice, then fills the remaining gaps one at a time, farthest point first. A finger 2 mm from a via across a gap but 8 mm away along the copper counts as 8 mm. Narrow spots get a smaller fallback via.

Command line

The panel's steps are commands of kistitch:

kistitch padvia
kistitch pourstitch --power
kistitch returnvia
kistitch pourstitch

--check --overlay places a step's heatmap without placing vias, and kistitch --dry-run <command> plans and runs DRC without placing vias. A dry run leaves the board as it was: it doesn't refill the zones, and --overlay only writes the heatmap images to files. Command line lists every option.

Documentation

kistitch uses the KiCad IPC API through kicad-python.

Metadata

Release files for kistitch 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kistitch 0.8.1
File Size Uploaded Provenance Actions
kistitch-0.8.1.tar.gz 413.7 kB With provenance Details for kistitch-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kistitch 0.8.1
File Interpreter ABI Platform Actions
kistitch-0.8.1-py3-none-any.whl Python 3 none any Details for kistitch-0.8.1-py3-none-any.whl

Total release size: 535.0 kB

Release files / kistitch-0.8.1.tar.gz

Download URL kistitch-0.8.1.tar.gz
Size 413.7 kB
Tags Source
SHA-256 checksum
How to use checksums
758c5ca39c5e708f5fd8253a5585b20a856d1a839af877e8097ff236deffd48f
BLAKE2b-256 checksum
How to use checksums
a8eb63a122fa7b2ba30d28c6165adb79a50945e765118eed65576c10b28d2a03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / kistitch-0.8.1-py3-none-any.whl

Download URL kistitch-0.8.1-py3-none-any.whl
Size 121.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10a69d735d6859cc3e0af196b32e444651e0ead086f9d0396da44bf489af8c46
BLAKE2b-256 checksum
How to use checksums
4be0900150d040becb2271ba4b12d27963f9194f54d8d8690af9e5433ef3cf3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for kistitch 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kistitch-0.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page