How to Route Differential Pairs in KiCad (for USB)

By ShawnHymel

Routing differential pair lines in PCB layout software can be a tricky process. Luckily, KiCad has a few tools to help us with the process. In this tutorial, we’ll walk you through the process of calculating the differential impedance and using that information to create a pair of USB data lines in a project.

If you would like to see this process in action, see the first part of this video:


Do Some Research

Before routing any high-speed signal buses or differential pairs, it’s a good idea to do some research into the requirements for those signals.

As with any good research, it’s a good idea to start at the source. Since I’m using USB 2.0 high speed as an example, I recommend downloading the USB 2.0 Specification to use as a reference. Note that it is a rather large, daunting manual, so we will use it as a reference while we read some other guides with easy-to-follow language. Here are a few great guides that I recommend reading through to help you understand how to route USB 2.0 high speed data lines:

Additionally, here are some good discussions by engineers about doing USB data line routing:

From these, we can determine a few requirements:

  • Differential impedance between the data lines should be 90 Ω  +/- 15%.
  • Single-ended impedance of each data line (with respect to GND) should be 45 Ω +/- 15.
  • The difference between the total length of the data lines should be no more than 0.150 inches (3.81 mm). In other words, try to keep the length of D+ and D- the same.
  • Data lines should be routed over an unbroken ground plane.
  • Avoid 90° bends in traces where possible (this includes vias)
  • Avoid stubs (traces that branch and go nowhere)

Determine Your PCB Characteristics

Go to your desired PCB manufacturer’s website and find the characteristics of the board you plan to produce. In this example, I’ll be using OSHPark’s 1 oz. copper prototyping service.

  • 1 oz copper (1.4 mil or 0.036 mm thick traces)
  • 1.6 mm board thickness
  • FR4 core
  • 2 layers
  • 6 mil (0.1524 mm) minimum trace width
  • 6 mil (0.1524 mm) minimum trace spacing

Note that this is a 2-layer board! Routing differential pairs on a 2-layer, 1.6 mm thick board is often quite difficult, as the data lines need to be wide to reach the desired impedance. With a thinner board (e.g. 0.8 mm thick dielectric material between copper layers), you can use much thinner traces for the differential pair. Generally, you will find that 4+ layer boards offer thin dielectric materials (e.g. FR4) between copper layers as well.

KiCad Net Naming

When you are creating your schematic, you must use one of the following suffixes when naming your differential pair nets:

  • +/- (e.g. D+ and D-)
  • _P/_N (e.g. D_P and D_N)

KiCad looks for these suffix pairs when using the differential pair routing tool during PCB layout.

KiCad differential pair net naming

Using the KiCad Impedance Calculator

KiCad has a built-in impedance calculator! In the project manager window, select Tools > Calculator Tools. Go to the TransLine tab. 

The transmission line calculator tab gives you several options for calculating impedance. We want to use the Coupled Microstrip Line option for our differential pair. Begin to fill out the Substrate Parameters section. 

Note that you can click on the “...” button by some of the parameters to get a pop-up to choose your material. For those, we are using copper for the conductor and FR4 for the dielectric material.

  • Er (dielectric constant): 4.5
  • TanD (dielectric loss factor): 0.02
  • Rho (conductor’s specific resistance): 1.72e-08
  • H (distance between traces and bottom ground plane): 1.6 mm (board thickness)
  • H_t (distance between traces and top ground plane): 10000 mm (we want this to be large to approximate infinity, as we are using an external layer for our differential pair--set this to the FR4 thickness if you are routing your USB lines on an internal layer sandwiched between two ground planes)
  • T (copper thickness): 0.03556 mm (corresponds to 1 oz. copper)
  • Rough (roughness of surface): 0 (not needed for our calculations)
  • mu Rel C (relative permeability of conductor): 1 (not needed for our calculations)

In the Physical Parameters section, we enter our desired trace settings. You’ll often find that you’ll want to start with the smallest possible distance between the traces (S) for your differential pair, as this will help keep trace width down. Then, you start to modify the trace width (W) until you achieve the desired differential impedance. Note that trace length (L) is not important for what we’re looking for in this case.

Start with a separation (S) of 0.1524 mm (OSH Park minimum), and adjust trace width (W) until you get a Zodd of about 45 Ω. Note that Zdiff (differential impedance) is equal to 2 * Zodd, so a Zodd of 45 Ω gives us a Zdiff of 90 Ω. Press the Analyze button to calculate the electrical parameters.

I found that a W of 0.77 mm gave me a differential impedance very close to 90 Ω.

KiCad impedance calculator

Board Setup

Open the PCB layout tool (pcbnew) and go to File > Board Setup. Make sure your Design Rules > Constraints match what your manufacturer can produce. Then, head to Project > Net Classes.

Add a new Net Class with your differential pair name (I gave mine the name “USB Data”). Set the Clearance to your manufacturer’s minimum, and set the Track Width (single track routing) to be the same as your default class’s width. Change the DP Width to be the trace width we calculated (0.77 mm), and change the DP Gap to be the separation we calculated (0.1524 mm).

On the bottom-right side, highlight the two differential pair net names. In Assign Net Class, select your differential pair net class name (“USB Data” for me), and click Assign To Selected Nets. Now, your differential pair lines will now follow the net rules we just created.

KiCad assign net parameters

Route Differential Pair

Click the trace routing tool (or press the ‘x’ key) to go into routing mode. In this case, because the footprint pads are so small, we need to route away from the pads first before using the differential pair tool. Click on one of your differential pair lines. 

You will likely find (if your DP widths are large, as is the case for this 2-layer board) that KiCad won’t want to route the lines. So, with the routing tool still activated, Right-click > Select Via/Track Width > Use Custom Values… Change the trace width to your default (e.g. 0.2 mm for me).

KiCad modify custom track width

Left-click again to start routing the trace. Try to fan away evenly from the pads, avoiding 90° bends.

KiCad fan out traces

Click Route > Route Differential Pair. Click on one of the traces, and the tool should automatically begin routing the two traces with the parameters you specified.

KiCad routing differential pair

If your tracks are too far apart, you should move your “fanout” traces a little closer, as you need the differential pair to maintain the exact separation distance as much as possible. You could also have the differential pair begin to move off in another direction to allow the tool to match the separation (as I did in my example).

Continue to route the traces between your components. Note that if you need to make a stop along the way (e.g. pull-up/down resistors), you should try your best to route through those pads, avoiding stubs (as I have done with the ESD suppression IC in the example below).

You should also make the traces as straight as possible, avoiding bends where possible. In my case, I needed to route to the outside edge of the board for the connector, so I had to gradually curve the traces using 45° bends.

KiCad differential pair USB data lines

Once again, if the differential pair widths are too large for the end component’s pads, use single-track routing with a custom width to bring the traces in to connect to the pads. Avoid this as much as you can (notice how I put the ESD suppression chip as close to the USB connector as I could).

Trace Length Matching

For high-speed buses, you almost always want the bits on each bus line to arrive at their destination at the same time (or as close as possible to the same time). If traces are different lengths, bits may arrive at different times! This is known as “bit skew” and can wreak havoc on communication buses.

Here is a good article about tackling bit skew.

With the selection tool, select one of the differential pair lines and look for the Length measurement field. This is the length of the total net (not the highlighted track segment)KiCad measuring net length

Click on the other net and subtract that net’s length from the first. For me, I get 21.1484 mm - 18.0616 mm = 3.0868 mm. This is within the allowable mismatch of 3.81 mm for USB data lines, so I should be OK.

Note: I have not tested this board yet, and I do not have a good enough oscilloscope to verify that my routing worked well. If you have an oscilloscope capable of measuring 480 MHz, you will want to use an “eye diagram” or “eye pattern” to perform this test. Here is a good video with such a demonstration.

To fix mismatched lengths, you can use the Route > Tune Skew of a Differential Pair tool. Start the tool, and click on the trace segment with the shorter net length. Right-click and select Length Tuning Settings... to bring up the tuning options.

Adjust trace length matching parameters

In most cases, you will want the skew to be 0. Feel free to adjust the other parameters to meet your PCB manufacturing requirements. Click OK.

Move the mouse along the trace you wish to tune, and you should see jogs (or serpentine paths) appear as the tool attempts to figure out how to increase the length of the shorter trace.

KiCad trace length matching tool

Note: in the example above, I’m pretending that I’m using a 0.8 mm thick PCB with 0.003 inch (0.0762 mm) trace spacing. This allowed me to use thinner data traces for the demonstration, as the tool did not work well with the super wide traces on my actual board.

You generally want the serpentine parts to be added closer to where the mismatch has occurred (for me, this is closer to the Hirose connector, as the paths are generally straighter near the USB connector). The tool will also tell you if the addition fixes the skew or not (you want it to say something like “Tuned: skew 0.000 mm”).

Click to accept the path modification.

KiCad matching trace lengths

Note that if you are working with a large parallel bus (more than 2 data lines), you can use the Route > Tune Length of a Single Track tool to add serpentine routing to your shorter lines individually to make their lengths add up to the length of the longest data line.


I hope this has helped you use the built-in KiCad tools for routing differential pairs, especially those pesky USB data lines! When in doubt, make the tracks as short and straight as possible.


Have questions or comments? Continue the conversation on TechForum, Digi-Key's online community and technical resource.

Visit TechForum