kicad-zcheck
Impedance and return-path checks on a KiCad board's own stack-up: the width each layer needs, how much routed copper is on target, and where returns jump.
A clean design-rule check proves the router followed the net classes. It doesn’t prove the copper hits its impedance. kicad-zcheck reads the stack-up from the board file, decides per layer whether a trace is microstrip or stripline, and measures what was really drawn. It answers three questions the net-class widths can’t:
- What width hits the target on each layer of this stack-up, and what would a different stack-up need?
- How much of the routed copper is within tolerance?
- Where a signal changes layers, how far does its return current travel to follow it?
Install
The board commands need KiCad’s pcbnew module, so use the Python that ships with KiCad 8 or newer. On macOS:
PY="/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3"
"$PY" -m pip install git+https://github.com/firedanceio/kicad-zcheck
"$PY" -m kicad_zcheck widths board.kicad_pcb
The stack-up comes from Board Setup > Physical Stackup. A board without one is treated as a uniform 1.6 mm stack, and the numbers are only indicative.
Commands
| Command | What it gives you |
|---|---|
widths | per signal layer: microstrip or stripline, the distance to the planes, the width for each target |
stack --candidate NAME=d1,d2,... | the same for a stack-up you’re thinking of ordering |
routed --nets PATTERN | how much of the selected nets’ copper is within tolerance, per layer, and the worst nets |
returns --nets PATTERN | at every layer change: the reference plane on each side and the distance to a return path |
Targets default to 50 ohm single-ended and 100 ohm differential; set your own with --se and --diff. A layer counts as a plane wherever it has zone fill, so a partial ground pour under a memory bus is a reference where it exists and nowhere else (--planes overrides that). routed and returns draw a board map with --map out.png, which needs Pillow.
Example: a 12-layer DDR4 board
Antmicro’s open-source DDR4 RDIMM tester routes a 72-bit memory channel on four inner layers. We don’t know the impedance Antmicro designed for, so this uses the common 40 ohm single-ended and 80 ohm differential:
NETS="--nets DQ* --nets CB* --nets CK0_* --nets CK1_* --nets A? --nets A1* --nets BA* --nets BG* --nets PARITY --nets CKE0 --nets ODT0 --exclude AUX* --exclude AV*"
python3 -m kicad_zcheck routed data-center-rdimm-ddr4-tester.kicad_pcb $NETS --se 40 --diff 80 --map routed.png
python3 -m kicad_zcheck returns data-center-rdimm-ddr4-tester.kicad_pcb $NETS --map returns.png
Three of the four inner layers keep 88 to 89 % of their single-ended copper within 10 % of 40 ohm, and up to 93 % of the pair copper within 10 % of 80. In7 is the odd one. It carries the eight check bits, and most of its single-ended traces sit just under 36 ohm, consistently, so none lands in the 36 to 44 band. That’s a choice of width on one layer, not a mistake you can see from the board file.

The amber patch in the middle is the escape from under the FPGA, where traces neck down to pass between the balls. On returns, 200 of the 268 layer changes move to a different ground plane, and the return current follows through a ground via 1 mm away at the median. The worst is 3.65 mm, on address lines dropping from the top layer at the module socket.
How accurate it is
The impedance numbers are closed-form estimates, checked against published values, exact solutions and a 2D field solve. The scripts are in docs/accuracy.
| Line | Model | Accuracy |
|---|---|---|
| Single-ended, inner layer between two planes | Wheeler’s stripline formula | within about 3 % of a field solve, centred or off-centre |
| Single-ended, outer layer | Hammerstad and Jensen, the model behind KiCad’s calculator | solder mask isn’t modelled and pulls the real value down a few ohm |
| Pair, inner layer between two planes | Cohn’s coupled-stripline result | 5 to 8 % high with typical copper |
| Pair, outer layer | the IPC-2141 coupling factor | treat it as plus or minus 10 % |
Limits
An inner layer with a plane on one side only isn’t handled yet. A trace there is computed as an outer-layer microstrip with air above it, so both its single-ended and pair numbers read high. Treat them as an upper limit, not an estimate.
More generally, these numbers are for finding problems and comparing options. Your fabricator’s impedance calculation and test coupons are the authority: send them the targets, widths and reference layers, and let them set the build.
Licence
Apache 2.0. The repository’s VALIDATION.md lists the unit tests, the accuracy checks and both Antmicro boards.
Read the announcement: kicad-zcheck: checking the wires a fast signal runs on.