STP Path Cost Calculator

Spanning Tree picks the path to the root bridge with the lowest root path cost, the sum of the port costs along the way. IEEE 802.1D-2004 and 802.1Q define the long method, cost = 20,000,000,000 ÷ link speed in kb/s, so 1 Gbps costs 20,000 and 10 Gbps costs 2,000. The legacy short method used 4 for 1 Gbps and 2 for 10 Gbps. Enter the link speeds of two candidate paths to get each port cost, the totals and the path STP will forward on.

☷

Path cost method and links

Choose the cost method, then list the link speed of every hop on each path toward the root bridge, in Mbps.

Example: 10000, 10000 = two 10G hops.

Short method accepts only 4, 10, 16, 100, 1000 and 10000.

Core calculation

Port cost = f(link speed, STP cost table). Path cost = Σ port costs along the path. Preferred path = lower total root path cost (ties need bridge/port priority).

Port cost. Map each link speed through the selected long/short cost table.

Path cost. Sum the port costs from the bridge toward the root.

Comparison. The lower total wins; equal totals need priority tie-breakers.

Vendor tables. Confirm long vs short mode matches the switch CLI before cutover.

▥

Calculation result

Root path cost is the sum of port costs on the path. The lower total wins; on a tie STP compares bridge ID, then port ID.

Path A root path cost

—

Path B root path cost

—
—
Path A port costs—
Path B port costs—
Cost difference—
Preferred path—

Vendors may use different defaults (for example short costs above 10G or LAG costs). Confirm the configured method with the switch CLI.

Methodology and engineering notes

METHODOLOGY

How to use

  1. Pick the long method (default on modern RSTP/MSTP) or the legacy short method.
  2. List each hop's link speed on path A toward the root bridge, in Mbps.
  3. Do the same for path B.
  4. Compare root path costs; the lower total becomes the root port path.

Long method

IEEE 802.1D-2004 and 802.1Q recommend Port Path Cost = 20,000,000,000 ÷ link speed in kb/s, within 1 to 200,000,000. Results: 10 Mbps 2,000,000; 100 Mbps 200,000; 1 Gbps 20,000; 10 Gbps 2,000; 25 Gbps 800; 40 Gbps 500; 100 Gbps 200; 400 Gbps 50.

Short method

IEEE 802.1D-1998 recommended 16-bit values: 4 Mbps 250, 10 Mbps 100, 16 Mbps 62, 100 Mbps 19, 1 Gbps 4, 10 Gbps 2. Speeds above 10 Gbps are not defined by that table, so the tool rejects them instead of guessing a vendor value.

Worked case: two 10G hops vs one 1G hop

Long method: path A = 2,000 + 2,000 = 4,000; path B = 20,000. STP prefers path A by 16,000 even though it has more hops. With the short method the totals are 2 + 2 = 4 and 4, a tie, so the bridge ID decides — one reason 802.1D-2004 moved to 32-bit costs.

Frequently asked questions

FAQ

How is STP path cost calculated?

Root path cost is the sum of the port costs from the switch to the root bridge. With the long method each port cost is 20,000,000,000 ÷ link speed in kb/s.

What is the STP cost of a 10G link?

2,000 with the long method (802.1D-2004/802.1Q) and 2 with the legacy short method.

What is the STP cost of 100G?

200 with the long method. The 802.1D-1998 short table stops at 10 Gbps, so 100G has no standard short value.

Why did IEEE change to long path costs?

16-bit short costs could not separate links faster than 10 Gbps, causing ties. The 32-bit long method scales to 10 Tb/s.

What happens when two paths have equal cost?

STP compares the sender bridge ID, then the sender port ID, and the lower value wins.

Recent calculations

PROJECT RECORDS

Standards and references

ENGINEERING WORKFLOW

Continue the engineering workflow

Current workflowLayer 2 Path Design Workflow

Pick the Spanning Tree forwarding path, then estimate the per-hop serialization delay along it.

Step 1 of 2

Related tools