Skip to content

KiCad design rules

OpenDFX has a design-rules file for KiCad 10. It checks your board against the recommendations in this book that a design rule check can see from the board alone. Examples are trace width, the copper around holes and the size of legend text. Each report names its recommendation and its address, so it leads you straight to the page that explains it.

Download the rules file, opendfx.kicad_dru

The file is licensed under the MIT License, like the book’s other code, so you can use it in any project.

  1. Copy the file into your project folder.
  2. Rename it to match your project. For example, a project called myboard.kicad_pro needs a rules file called myboard.kicad_dru, because KiCad only reads a rules file with the project’s name.
  3. Open Board Setup, and under Solder Mask/Paste set Minimum web width to 0.1 mm. KiCad takes this value from Board Setup, not from a rules file (PCB-DFA-032).
  4. Run the design rule check (Inspect, then Design Rules Checker).

You can also paste the file’s text into Board Setup, under Design Rules, Custom Rules.

If your project already has a .kicad_dru file, or custom rules in Board Setup, keep them unchanged until you have checked how the two sets of rules interact. When two rules of the same kind apply to the same item, KiCad uses the later one. One OpenDFX rule also changes how pads join copper pours when the zones are refilled. Follow the steps in If the project already has a rules file.

For a new design, you can start from the starter project instead. It has the rules file and the Board Setup values already in place.

The rules add to KiCad’s own design rule check. They don’t switch any of KiCad’s checks off. They never loosen your net class clearances or your Board Setup minimums, with two exceptions. The board edge check replaces the board edge clearance in Board Setup, which is also 0.5 mm unless you’ve changed it. The legend check replaces the silkscreen clearance in Board Setup, which is 0 mm unless you’ve changed it.

One rule is a setting rather than a check. Plated through-hole pads join copper pours through thermal reliefs (PCB-DFA-044), even where the pour is set to join pads solidly.

Section titled “Recommended values, and minimums where you need them”

Most recommendations in this book give a minimum and a recommended value. The file checks the recommended values across the whole board. Where a design really needs to be tighter, draw a rule area (Place, then Add Rule Area) and name it OpenDFX minimum. Inside that area, the file checks the minimum values instead. Keep these areas small, and draw them only where you need them. They also show your fab and your assembler exactly where the tight spots are. Any name that starts with OpenDFX minimum works, such as OpenDFX minimum 2, so you can draw as many as you need.

The values are for 1 oz finished copper.

What is checked Recommendation Checked across the board Checked inside an OpenDFX minimum area
Trace width PCB-DFM-020 0.15 mm 0.1 mm
Spacing between copper on different nets, including pours PCB-DFM-020, PCB-DFM-029 0.15 mm 0.1 mm
Copper on another net to the edge of a drilled hole, on every layer PCB-DFM-022, PCB-DFM-007 0.25 mm 0.2 mm
Finished diameter of a drilled hole, except laser microvias PCB-DFM-024 0.25 mm 0.2 mm
Annular ring on plated holes and vias PCB-DFM-026 0.15 mm 0.125 mm
Copper to the board edge PCB-DFM-002 0.5 mm 0.25 mm
No copper pad on a non-plated hole PCB-DFM-007 Always Always
Width of a routed non-plated slot PCB-DFM-042 1 mm 1 mm
Width of a routed plated slot PCB-DFM-042 1 mm 0.5 mm
Solder mask web between pads, and between a via and a pad, set in Board Setup PCB-DFA-032, PCB-DFA-078 0.1 mm 0.075 mm
Height of legend text PCB-DFM-039 1 mm 0.8 mm
Line width of legend text PCB-DFM-039 0.15 mm 0.15 mm
Legend to exposed copper and holes PCB-DFM-040, PCB-DFM-045 0.1 mm 0.1 mm
Diameter of a test point pad PCB-DFT-008 1.0 mm 0.9 mm
Spacing of test points, center to center PCB-DFT-008 2.54 mm 1.9 mm
Test point to the board edge PCB-DFT-009 5 mm 3 mm
Bottom surface-mount pads to through-hole pads, for wave or selective soldering, as a warning PCB-DFA-043 3 mm 2 mm
Through-hole pads join copper pours through thermal reliefs PCB-DFA-044 Always Always

The book recommends legend lines 0.18 mm wide. For now the file checks 0.15 mm across the whole board, because KiCad’s own footprint library draws reference designators with 0.15 mm lines.

The copper is kept 0.5 mm from every board edge, because KiCad can’t tell a V-scored edge from a routed one, and 0.5 mm is safe for both.

The check on bottom surface-mount pads assumes the through-hole parts are on the top, so their pins are soldered on the bottom. It only matters if those pins are wave or selectively soldered, so it is a warning, not an error.

The test point spacing is measured from pad edge to pad edge, assuming pads of the recommended size. So with test point pads larger than 1.0 mm, the check asks for slightly more than 2.54 mm between centers.

The file also holds two sets of rules that are switched off. One is for 2 oz finished copper, where traces and gaps should be at least 0.25 mm, and at least 0.2 mm inside an OpenDFX minimum area (PCB-DFM-020). The other keeps every part at least 3 mm from the board edges, so the board can run without rails (PCB-DFA-015). To switch either on, remove the # at the start of each of its lines.

The rules file checks the board. A second tool, check_release.py, checks the files you send: the Gerber files, the drill files, the netlist, the placement file and the BOM. It is written for files exported from KiCad 10. Its help text lists the KiCad commands that export a release the way this book recommends. Run it with Python 3 on the folder that holds the files, for example python3 check_release.py release/ --board myboard.kicad_pcb. It reports each check as Met, Not met or Needs a person, with the recommendation it comes from.

KiCad can’t tell which edges will be V-scored or broken away. So keeping ceramic capacitors away from breakaway edges (PCB-DFA-016) and keeping copper away from mouse-bite holes (PCB-DFA-012) are up to you. It can’t see how tall a part is, so the extra room a test point needs next to a tall part (PCB-DFT-009) is up to you too. It can’t see the radius the router leaves in an inside corner (PCB-DFM-042). The drill size check assumes a 1.6 mm board. On a thicker board, keep the ratio of board thickness to drill diameter at 8 to 1 or less (PCB-DFM-024). Everything else in the book, such as the drawings, the BOM and the panel, is for you and your manufacturer to check.

A report from this file means a design is harder to build than it needs to be, not that it can’t be built. If your fab or your assembler can do better, and you’ve agreed it with them, follow their limits.

OpenDFX for Printed Circuit Boards, by Chris Denney. Licensed under CC BY-SA 4.0. The recommendations data is licensed under CC BY 4.0. OpenDFX is a trademark of Chris Denney. Please share the book widely; see how to use the name and the logo and press kit.