STP Cost
Calculate Spanning Tree Protocol port cost based on link speed and STP version.
About STP Cost
Spanning Tree Protocol assigns a cost to each link based on its speed, and switches sum these costs along every path to the root bridge to determine the lowest-cost (fastest, most direct) path, which becomes the active forwarding path while redundant paths are blocked to prevent loops. The legacy 802.1D 'short' cost values used a 16-bit scale poorly suited to modern high-speed links, so the 802.1T 'long' cost values use a much wider 32-bit range that better differentiates between 1G, 10G, 40G, and 100G links.
Formula
STP path cost
path_cost = per_link_cost(speed) × number_of_hops
- C_{link}(v)
- Cost assigned to a link of speed v
- h
- Number of hops to the root bridge
Worked example
With the default values below, STP Cost returns Total STP Path Cost of 60,000. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Link Speedone of 10 Mbps, 100 Mbps (Fast Ethernet), 1 Gbps (Gigabit Ethernet), 10 Gbps, 40 Gbps, 100 Gbps
- 1 Gbps (Gigabit Ethernet)
- Number of Hops to Rootaccepts 1–40
- 3
- Cost Standardone of IEEE 802.1D (short, legacy), IEEE 802.1T (long, current)
- IEEE 802.1T (long, current)
Results
- Total STP Path Cost
- 60,000
- Cost per Link
- 20,000
- Link Speed
- 1 Gbps
- Standard Used
- IEEE 802.1T (long)
Step by step
- 1Values used
- 2STP path cost
- 3Total STP Path Cost= 60,000
- 4Cost per Link= 20,000
- 5Link Speed= 1 Gbps
- 6Standard Used= IEEE 802.1T (long)
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What are the standard STP cost values by link speed?
Under the IEEE 802.1T 'long' method (current default): 10 Mbps = 2,000,000; 100 Mbps = 200,000; 1 Gbps = 20,000; 10 Gbps = 2,000; 40/100 Gbps = 500/200. Under the older 802.1D 'short' method: 10 Mbps = 100; 100 Mbps = 19; 1 Gbps = 4; 10 Gbps and above = 2.
Why does a lower cost win in Spanning Tree?
STP's root path cost represents the cumulative 'expense' of reaching the root bridge — lower cost implies a faster, more direct path. Switches select the path with the lowest total accumulated cost as the active forwarding path, blocking higher-cost redundant paths to prevent Layer 2 loops.
Why did IEEE introduce the 'long' cost method?
The original 'short' method used an 8-bit-derived scale (values like 2, 4, 19, 100) that couldn't meaningfully distinguish between very fast modern links — 10G, 40G, and 100G all round to nearly the same cost. The 'long' method uses much larger, more granular values so higher-speed links are still clearly favored over slower ones even at multi-gigabit scale.
