Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

Path Cost

Direct answer

Path cost is the STP cost of a port, based on its speed. The root path cost is the sum of the port costs from a switch to the root, and decides root and designated ports.

When to use this

Use it to steer which uplink forwards, or to explain why a slower path is used.

First 30 seconds

1. show spanning-tree summary | include Pathcost — short or long method?

2. show spanning-tree vlan <id> — Cost per port and Root cost.

3. Add the costs along each path to the root — which is lowest?

4. Adjust with spanning-tree vlan <id> cost <n> on the port.

5. Same method on all switches?

Operational verification

port speed → port cost (short or long method) → costs summed towards the root → lowest root path cost decides root and designated ports

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE · Cisco IOS XE
Key commandspanning-tree vlan <vlan-list> cost <cost>
Scope / prerequisiteUse it to steer which uplink forwards, or to explain why a slower path is used.
Reference · 1
What next?3 suggested next steps
Catalog command links1
Evidence0
On this pageJump to a specific section
Cisco IOS / IOS XE first

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational verification and known-good state Verify boundary

Verify the exact root bridge first; comparing costs while the root itself is wrong leads to false conclusions. For each candidate uplink, read the received/root path information and local port cost, then calculate why the selected root port is superior. Check whether cost is default or explicitly configured and whether the platform uses the expected path-cost method. When two paths have equal cost, continue through the documented bridge/port tie-breakers rather than calling the result random. After identifying the selected forwarding uplink, verify MAC learning and traffic actually follow the expected tree. This section is authored reference guidance for Path Cost in the STP context.

Step 2 Verification & troubleshooting Narrow the fault

Use show spanning-tree vlan <vlan> / interface detail to compare port cost and resulting root path cost before and after tuning.

Step 3 Failure signatures and troubleshooting branches Narrow the fault

If STP chooses the “wrong” uplink, determine whether it is actually lower cost due to a speed change, manual cost, Port-Channel state or upstream topology. If costs are equal, inspect upstream sender bridge ID and port ID. If cost changes repeatedly, correlate with link/member flaps and Port-Channel membership. If the STP tree is correct but application traffic uses another Layer-3 path, do not tune STP to solve an IP-routing problem. Avoid globally changing bridge priorities or costs when one bounded interface/instance explains the path selection. This section is authored reference guidance for Path Cost in the STP context.

Step 4 When the problem is really fixed Narrow the fault

Closure means the intended root port and alternate path remain stable with the designed path cost after convergence and during a controlled failover/recovery if redundancy is part of the objective. Replay representative Layer-2 traffic and confirm MAC learning follows the resulting tree. Check another VLAN or instance sharing the physical links to make sure a local cost change did not unintentionally shift its topology. Document actual observed cost/state separately from this reference guidance. This section is authored reference guidance for Path Cost in the STP context.

Step 5 Common mistakes Narrow the fault
  • Mixing short and long path cost methods between switches.
  • Unequal costs on parallel links.
Command lookup Jump straight to Cisco syntax
Key points

Short method (default on older IOS): 10 Mb/s = 100, 100 Mb/s = 19, 1 Gb/s = 4, 10 Gb/s = 2. Long method (spanning-tree pathcost method long) scales to faster links: 1 Gb/s = 20 000, 10 Gb/s = 2 000. Use the same method on every switch. An EtherChannel's cost depends on its bandwidth.

Key checks
  • show spanning-tree vlan <id> — root ID, local bridge ID, and each port's role, state and cost.
  • show spanning-tree root — the root bridge, root cost and root port per VLAN.
  • show spanning-tree vlan <id> detail — BPDUs sent and received, topology changes and their source.
  • show spanning-tree summary — mode, enabled features and port counts per state.
  • show spanning-tree inconsistentports — ports blocked by root guard, loop guard or type inconsistency.
ReferenceWhat it is1 section · depth on demand

What it is

STP path cost is the metric used to prefer lower-cost paths toward the root. Interface speed maps to default cost values under the active cost method.

ReferenceWhy it matters1 section · depth on demand

Why it matters

Use cost to influence or explain root-port and designated-port selection without changing the root bridge itself.

ReferenceImportant terms & boundaries4 sections · depth on demand

Key points

Lower accumulated root path cost is preferred. Manually changing cost can alter the active Layer 2 path and should be documented.

In depth

Path cost: the value STP adds up to find the best way to the root

Each port has a cost. The root path cost is the sum of the costs of the receiving ports along the path. The Catalyst 9300 guide states that cost is derived from media speed and that the short method is the default, with values of 100 (10 Mb/s), 19 (100 Mb/s), 4 (1 Gb/s), 2 (10 Gb/s) and 1 (25 or 40 Gb/s).

SpeedShort (default)Long (pathcost method long)
10 Mb/s1002,000,000
100 Mb/s19200,000
1 Gb/s420,000
10 Gb/s22,000
25/40 Gb/s1800 / 500
100 Gb/s1200

With the short method, 25, 40 and 100 Gb/s links all have cost 1, so STP can't tell them apart. The long method keeps the differences.

C9300(config)# spanning-tree pathcost method long
C9300(config)# interface Te1/1/2
C9300(config-if)# spanning-tree vlan 20 cost 4000
C9300# show spanning-tree pathcost method
Spanning tree default pathcost method used is long
C9300# show spanning-tree interface Te1/1/2

Rules

RuleReason
Use the same method on all switchesMixed methods give inconsistent path choices
Set costs on uplinks, not access portsOnly uplinks lead to the root
Per-VLAN cost for load balancingspanning-tree vlan <list> cost <n>
Port-channel costBased on bundle bandwidth; it changes when members fail

EtherChannel side effect

A 2 × 10 Gb/s port-channel can get a lower cost than a single 10 Gb/s link. If a member fails, the cost rises and STP may move the root port. That causes a topology change in the middle of a link failure. Fix the cost on the port-channel if that behaviour isn't wanted.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Quick reference

Path cost is the STP metric: each port has a cost based on its speed, and a switch's root path cost is the sum of costs along the path to the root. Lower total cost wins when choosing root ports.

SpeedShort cost (802.1D-1998)Long cost (802.1t)
100 Mbps19200,000
1 Gbps420,000
10 Gbps22,000
100 Gbps—200
spanning-tree pathcost method long
interface Gi1/0/50
 spanning-tree vlan 10 cost 10

Documented example, not captured output.

Use the long method in networks with 10 Gbps and faster links, and configure it consistently on all switches.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Mechanics and state ownership

Path cost gives STP a deterministic way to prefer one Layer-2 path to the root over another. A switch receives a neighbor’s advertised root path cost, adds the cost of its local receiving port and compares the resulting root information with other candidates. Lower cost wins before later tie-break fields such as upstream bridge ID and port ID. The cost associated with a link can come from standardized speed mappings or explicit configuration, and long versus short cost methods can change the numeric scale. Port-Channel links are evaluated as logical STP ports, so member state can indirectly alter the operational bandwidth/cost model depending on platform behavior. This section is authored reference guidance for Path Cost in the STP context.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Switching → STP → Spanning Tree Fundamentals → Path Cost. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
Embedded reference data

Quick lookup tables

Path Cost operational reference

Topic-specific bounded interpretation: known-good state, suspicious signatures and the next technical proof boundary.

Cost decisionKnown-goodFailure signatureNext boundary
Root bridgeIntended root fixedWrong root invalidates comparisonBridge priority
Local port costMatches design/operational linkUnexpected override/speedInterface config
Total root costPreferred path lowerHigher path selectedTie-break/state
Equal-cost tieDeterministic IDs decideAssumed random behaviorBridge/port ID
Forwarding pathMatches selected treeSTP correct, traffic differsMAC/L3 path
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Field-by-field state interpretation

In show spanning-tree vlan <id>, the Cost column is each port's own path cost and the Root ID Cost is the total cost from this switch to the root. Default short costs are 19 for 100 Mbps, 4 for 1 Gbps and 2 for 10 Gbps; with spanning-tree pathcost method long they are 200000, 20000 and 2000.

Confirmation

Confirm action

Continue?