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 shows that the router followed the net classes. It says nothing about impedance. kicad-zcheck reads the stack-up from the board file and decides, layer by layer, whether a trace is a microstrip or a stripline. It then measures the copper that was actually drawn, in order to answer three questions that the net-class widths leave open:
- Which width meets the target on each layer of this stack-up, and which width would a different stack-up require?
- What share of the routed copper lies within tolerance?
- At each change of layer, how far does the return current have to travel in order to follow the signal?
Limits
One case is not handled yet, namely an inner layer with a plane on one side only. A trace on such a layer is computed as an outer-layer microstrip with air above it. Both its single-ended and its pair numbers then read high, and they are best treated as an upper limit rather than an estimate.
The numbers are meant for finding problems and comparing options. On the finished board, the impedance calculation and the test coupons of the fabricator are the authority. The fabricator should be sent the targets, the widths and the reference layers, so that the build can be set up to match.
Install
Every command that reads a board needs the pcbnew module of KiCad. Those commands are therefore run with 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. If a board has no stack-up defined, the tool treats it as a uniform 1.6 mm stack, and the numbers it reports are then 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 that is being considered for an order |
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 |
The default targets are 50 ohm single-ended and 100 ohm differential. Other targets are set with --se and --diff. Wherever a layer has zone fill, it counts as a plane, so a partial ground pour under a memory bus is a reference only where the pour exists. --planes overrides this. Both routed and returns draw a board map when --map out.png is passed, and Pillow is needed for the map.
Example: a 12-layer DDR4 board
Antmicro’s open-source DDR4 RDIMM tester routes a 72-bit memory channel on four inner layers. The impedance that Antmicro designed the board for is unknown. The example therefore uses the common targets of 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 exception. It carries the eight check bits, and most of its single-ended traces sit consistently just under 36 ohm, so none of them falls in the 36 to 44 band. That pattern points to a width chosen for one layer, and not to a mistake that the board file could reveal.

The amber area in the middle of the map is the escape from under the FPGA, where the traces narrow to pass between the balls. The returns command finds that 200 of the 268 layer changes move to a different ground plane. At the median, the return current follows through a ground via 1 mm away. The longest distance is 3.65 mm, on address lines that drop from the top layer at the module socket.
How accurate it is
The impedance numbers are closed-form estimates. They have been checked against published values, against exact solutions and against a 2D field solve, and the scripts for those checks 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 is not 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 % |
Licence
Apache 2.0. The unit tests, the accuracy checks and the results on both Antmicro boards are listed in the VALIDATION.md file of the repository.
Read the announcement: kicad-zcheck: checking the wires a fast signal runs on.