Path Cost Fundamentals
Path cost is the metric spanning tree uses to determine the best (shortest/cheapest) path to the root bridge. Each link in the network has an associated cost based on its speed. The total root path cost is the sum of all link costs from a non-root switch to the root.
New to STP? Start with the full spanning-tree guide, then come back here for the deep dive.
Example:
[SW1] ─────────── [SW2] ─────────── [SW3]
(root) 1 Gbps cost 4 1 Gbps cost 4
Root path = 0 + 4 + 4 = 8 on SW3
Lower cost = better path = preferred for root port selection.
Link Costs by Speed
Cisco defines path costs based on link speed. There are two scales: the short values from IEEE 802.1D-1998 and the long values from 802.1t, carried into 802.1D-2004. The default depends on platform and release; the IOL-L2 switches in this lab default to short.
Cost Table
The long values follow 20,000,000 ÷ link speed in Mbps (20,000,000 ÷ 10 = 2,000,000 for 10 Mbps), which leaves room for faster links.
Why Two Values?
The old values had minimal difference between fast links:
802.1D (short):
1 Gbps: 4
10 Gbps: 2 (10× faster, but the cost only halves)
100 Gbps: no smaller value is defined; costs are whole numbers, so the scale runs out
Modern values scale better:
Modern:
1 Gbps: 20,000
10 Gbps: 2,000 (10× faster, cost is 10× lower)
100 Gbps: 200 (100× faster, cost is 100× lower)
400 Gbps: 50 (400× faster, cost is 400× lower)
Checking Which Values Your Switch Uses
SW2# show spanning-tree pathcost method
Spanning tree default pathcost method used is short- short: 802.1D-1998 values (100, 19, 4, 2)
- long: 802.1t / 802.1D-2004 values (2,000,000, 200,000, 20,000, 2,000)
To change (if needed):
SW1(config)# spanning-tree pathcost method long
Cisco recommends long for all new deployments.
The IOL-L2 switches in the lab below report short, which is why this post's worked examples use 4 for a 1 Gbps link.
I checked the higher-speed values on IOL-L2 too. IOL's Ethernet ports are fixed at 10 Mbps and reject the speed command, but on this image the STP port cost follows the interface bandwidth value. The statement only changes the number IOS uses in the calculation, not the link itself. With the short method and bandwidth 10000000 (10 Gbps) on SW3 Ethernet0/3 in the second lab described under Example 2:
SW3(config)# spanning-tree pathcost method short
SW3(config)# interface Ethernet0/3
SW3(config-if)# bandwidth 10000000
SW3# show spanning-tree vlan 1 interface Ethernet0/3
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Root FWD 2 128.4 P2pReadbacks for the other values on the same port:
SW3 Ethernet0/3: port cost from show spanning-tree vlan 1 interface Ethernet0/3
bandwidth (Kbit/sec) short long
10,000 (default) 100 2000000
100,000 19 (not tested)
1,000,000 4 20000
10,000,000 2 2000So the 10 Gbps short value is 2, matching IEEE 802.1D-1998, not 1.
Calculating Root Path Cost
Root path cost is calculated hop by hop. Each switch adds the cost of its port facing the next hop.
Example 1: Linear Topology
[SW1] Et0/1 ──── Et0/1 [SW2] Et0/2 ──── Et0/2 [SW3] Et0/3 ──── Et0/3 [SW4]
(root) 1 Gbps 1 Gbps 1 Gbps
cost 4 cost 4 cost 4
I rebuilt this topology in my home lab with four Cisco IOL-L2 switches (IOS XE 17.18.2, rapid-PVST, VLAN 1, short path-cost method). IOL keeps Ethernet0/0 for management, so the links use Et0/1, Et0/2 and Et0/3, and their port IDs are 128.2, 128.3 and 128.4. IOL's Ethernet ports run at 10 Mbps and defaulted to cost 100, so I set every inter-switch port to spanning-tree cost 4 to model 1 Gbps. SW1 is root with priority 4096; SW2 uses 24576, SW4 28672 and SW3 the default 32768.

SW2's Calculation
SW2 receives BPDU from SW1 (root):
BPDU from SW1:
Root ID = SW1
Root Path Cost = 0 (SW1 is root)
Sender Port ID = 128.2 (SW1 Et0/1)
SW2 receives on Et0/1 (cost 4):
SW2's root path cost = 0 (from root) + 4 (SW2 Et0/1) = 4
SW2 sends BPDU out Et0/2:
Root ID = SW1 (unchanged)
Root Path Cost = 4 (what SW2 calculated)
Sender Port ID = 128.3 (SW2 Et0/2)
SW3's Calculation
SW3 receives BPDU from SW2:
BPDU from SW2:
Root ID = SW1
Root Path Cost = 4 (from SW2)
Sender Port ID = 128.3 (SW2 Et0/2)
SW3 receives on Et0/2 (cost 4):
SW3's root path cost = 4 (from BPDU) + 4 (SW3 Et0/2) = 8
SW3 sends BPDU out Et0/3:
Root ID = SW1
Root Path Cost = 8
Sender Port ID = 128.4 (SW3 Et0/3)
SW4's Calculation
Root path cost = 8 (from BPDU) + 4 (SW4 Et0/3) = 12
Result:
Root path costs toward root:
SW1: 0 (is root)
SW2: 4 (one hop)
SW3: 8 (two hops)
SW4: 12 (three hops)
The lab matched those numbers on every switch. Each non-root switch shows its root path cost and root port in the Root ID block:
SW1# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address aabb.cc00.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Desg FWD 4 128.2 P2p
SW2# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 4
Port 2 (Ethernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address aabb.cc00.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Root FWD 4 128.2 P2p
Et0/2 Desg FWD 4 128.3 P2p
SW3# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 8
Port 3 (Ethernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Root FWD 4 128.3 P2p
Et0/3 Desg FWD 4 128.4 P2pExample 2: Mixed Link Speeds
[SW1] ════ Po1 ════ [SW2] ──── Et0/3 ──── [SW3]
(root) 10 Gbps 1 Gbps
cost 2,000 cost 20,000
Calculations
SW2:
Root path cost = 0 + 2,000 = 2,000
SW3:
Root path cost = 2,000 + 20,000 = 22,000
If SW3 also has a direct 1 Gbps link to SW1:
Direct: 0 + 20,000 = 20,000
Via SW2: 2,000 + 20,000 = 22,000
The direct link wins by 2,000

I checked this on a second IOL-L2 lab with three switches and the long method. SW1 is root, SW1 and SW2 are joined by Port-channel1, SW2 Et0/3 connects to SW3 Et0/3, and SW1 Et1/0 connects directly to SW3 Et1/0. Since the ports are 10 Mbps, I modeled the speeds with spanning-tree cost: 2,000 on Po1 for 10 Gbps, and 20,000 on both SW3 links for 1 Gbps. With the direct link shut, SW3 reached the root through SW2 at 22,000:
SW3# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 22000 2 20 15 Et0/3With the direct link up, SW3 moved its root port to Et1/0 at 20,000 and made Et0/3 Alternate:
SW3# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 20000 2 20 15 Et1/0
SW3# show spanning-tree vlan 1
...
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Altn BLK 20000 128.4 P2p
Et1/0 Root FWD 20000 128.5 P2pBut if the topology was:
[SW1] ──────────── [SW2]
(root) 10 Gbps
cost 2,000
|
├── (to SW3 via 100 Mbps)
│ cost 200,000
│
└── (to SW3 via 1 Gbps)
cost 20,000
Then the 1 Gbps path is clearly preferred: 2,000 + 20,000 = 22,000 against 2,000 + 200,000 = 202,000. That case is plain arithmetic from the standard values; I did not build it.
Verifying Costs in Real Networks
Show Spanning-Tree Interface Cost
SW2# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 4
Port 2 (Ethernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address aabb.cc00.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Root FWD 4 128.2 P2p
Et0/2 Desg FWD 4 128.3 P2pThe Cost column shows each port's own cost, not the root path cost. Both ports show 4 because I set them; before that, the same SW2 ports showed IOL's 10 Mbps default of 100:
SW2# show spanning-tree vlan 1
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Root FWD 100 128.2 P2p
Et0/2 Desg FWD 100 128.3 P2pChecking Root Path Cost
SW4# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 12 2 20 15 Et0/3Root Cost is 12 through root port Et0/3, which matches the linear example: the root ports on SW2, SW3 and SW4 each add 4, so 0 + 4 + 4 + 4 = 12.
Show Spanning-Tree Detail with Port Costs
SW4# show spanning-tree vlan 1 detail | include is designated|Port [0-9]|port path cost|Designated root|Designated bridge|Designated port id|Port path cost
Port 4 (Ethernet0/3) of VLAN0001 is root forwarding
Port path cost 4, Port priority 128, Port Identifier 128.4.
Designated root has priority 4097, address aabb.cc00.0100
Designated bridge has priority 32769, address aabb.cc00.0300
Designated port id is 128.4, designated path cost 8Et0/3 is SW4's root port with a port path cost of 4. The designated bridge on that segment is SW3 (priority 32769), sending from port 128.4 with a designated path cost of 8, so SW4's root path cost is 8 + 4 = 12.
Manually Setting Port Cost
Sometimes default costs don't reflect your network design. You might want to force a particular path, even if it's technically "slower," due to quality, congestion, or failover design.
Setting Cost on a Single Port
SW4(config)# interface ethernet 0/3
SW4(config-if)# spanning-tree cost 8
SW4(config-if)# exit
Now SW4's root path cost becomes:
Old root path cost: 12
New: 8 (root path cost advertised by SW3) + 8 (our port cost) = 16
That is worse, not better. Raising a port cost makes the path less attractive.
The lab agreed:
SW4# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 16 2 20 15 Et0/3To prefer this path:
SW4(config)# interface ethernet 0/3
SW4(config-if)# spanning-tree cost 2
New root path cost:
8 (from BPDU) + 2 (our new port cost) = 10
Lower than the original 12, so the path through this port is cheaper.
SW4# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 10 2 20 15 Et0/3Verifying Manual Cost
SW4# show spanning-tree vlan 1 interface Ethernet0/3
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Root FWD 2 128.4 P2pCost shows 2 instead of 4. I set it back to 4 before the next test.
Cost and EtherChannel
When multiple ports are bundled into an EtherChannel, STP sees the whole channel as a single port with a single cost. That cost comes from the bundle's aggregate bandwidth, not from the member cost divided by the number of links.
Example: EtherChannel Setup
[SW1] Et0/1 + Et0/2 ════ Et0/1 + Et0/2 [SW2]
2 x 10 Mbps links bundled into Port-channel1 (LACP)
Po1 bandwidth: 20,000 Kbit/sec
Single 10 Mbps port: 100 (short) 2,000,000 (long)
Port-channel1: 56 (short) 1,000,000 (long)
EtherChannel Cost Calculation
In the second lab, SW1 and SW2 are joined by a two-port LACP Port-channel1. STP takes the bundle's aggregate bandwidth, the sum of its active members, and derives the port-channel cost from that number:
EtherChannel cost = path cost for (sum of active member bandwidth)
Long: 20,000,000 ÷ 20 Mbps = 1,000,000
Short: 20 Mbps sits between the 10 Mbps (100) and 100 Mbps (19) entries;
this IOL-L2 image reported 56
Verifying EtherChannel Cost
! short method
SW2# show interfaces Port-channel1 | include BW|Members
MTU 1500 bytes, BW 20000 Kbit/sec, DLY 1000 usec,
Members in this channel: Et0/1 Et0/2
SW2# show spanning-tree vlan 1 interface Port-channel1
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Root FWD 56 128.65 P2p
! long method
SW1# show spanning-tree vlan 1 interface Port-channel1
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Desg FWD 1000000 128.65 P2p
! long method, one member (Et0/2) shut
SW1# show interfaces Port-channel1 | include BW|Members
MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
Members in this channel: Et0/1
SW1# show spanning-tree vlan 1 interface Port-channel1
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Desg FWD 2000000 128.65 P2pPort-channel1 shows 56 under the short method, against 100 for a single member, and 1,000,000 under the long method, half the 2,000,000 of a single 10 Mbps port. With one member shut, Po1's bandwidth fell to 10,000 Kbit/sec and its long-method cost went to 2,000,000, the same as one port. It returned to 1,000,000 when the member came back.
Setting EtherChannel Cost Manually
SW2(config)# interface port-channel 1
SW2(config-if)# spanning-tree cost 2
Cost Considerations for Network Design
Scenario: Preferring Direct Links Over Hop Count
[SW1] (root) ════ Po1, cost 2,000 ════ [SW2]
Et1/0 Et0/3
cost 20,000 cost 20,000
\ /
└──────────── [SW3] ──────────┘
This is the triangle from the mixed-speed lab. By default SW3 uses its direct link to the root: 20,000 beats 2,000 + 20,000 = 22,000 through SW2. That's normally what you want. If the path through SW2 is the one you want instead, for example because the SW1–SW2 core is faster and the direct link is only a backup, lower the cost on SW3's port toward SW2 until that path totals less than the direct link.
In the lab I set SW3 Et0/3 to cost 2,000:
SW3(config)# interface ethernet 0/3
SW3(config-if)# spanning-tree cost 2000
SW3# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 4000 2 20 15 Et0/3
SW3# show spanning-tree vlan 1
...
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Root FWD 2000 128.4 P2p
Et1/0 Altn BLK 20000 128.5 P2pSW3's root path cost became 2,000 + 2,000 = 4,000 through Et0/3, and the direct link Et1/0 became Alternate. I set Et0/3 back to 20,000 afterwards.
Scenario: Load Balancing Across VLANs
With PVST+ or Rapid PVST+, each VLAN has its own spanning tree, so each VLAN can have its own root:
VLAN 10 (Users): root SW1
VLAN 20 (Servers): root SW2
[SW1] ════ Po1 ════ [SW2]
Et1/0 Et0/3
\ /
[SW3]
Make SW1 the VLAN 10 root and SW2 the VLAN 20 root. SW3 then uses its direct uplink to each VLAN's root and blocks its other uplink for that VLAN.
This distributes traffic across both uplinks:
VLAN 10: SW3 Et1/0 (to SW1) forwards, Et0/3 blocks
VLAN 20: SW3 Et0/3 (to SW2) forwards, Et1/0 blocks
Implementation:
! On SW1:
SW1(config)# spanning-tree vlan 1,10 priority 4096
! On SW2:
SW2(config)# spanning-tree vlan 20 priority 4096
Now each VLAN uses its preferred root. SW3 in the second lab, with both uplinks at the modeled 1 Gbps cost of 20,000 (long method):
SW3# show spanning-tree root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 20000 2 20 15 Et1/0
VLAN0010 4106 aabb.cc00.0100 20000 2 20 15 Et1/0
VLAN0020 4116 aabb.cc00.0200 20000 2 20 15 Et0/3
SW3# show spanning-tree vlan 10
...
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Altn BLK 20000 128.4 P2p
Et1/0 Root FWD 20000 128.5 P2p
SW3# show spanning-tree vlan 20
...
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Root FWD 20000 128.4 P2p
Et1/0 Altn BLK 20000 128.5 P2pIf root placement alone doesn't give the split you want, spanning-tree vlan <id> cost sets a port cost for one VLAN only. On SW3, spanning-tree vlan 10 cost 2000 on Et1/0 changed VLAN 10's cost on that port and left VLAN 20's alone:
SW3(config)# interface ethernet 1/0
SW3(config-if)# spanning-tree vlan 10 cost 2000
SW3# show spanning-tree vlan 10 interface Ethernet1/0
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0010 Root FWD 2000 128.5 P2p
SW3# show spanning-tree vlan 20 interface Ethernet1/0
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0020 Altn BLK 20000 128.5 P2pVerifying and Troubleshooting Cost
Problem: Unexpected Root Port Selection
If a switch chose an unexpected root port:
SW3# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 22000 2 20 15 Et0/3Cost is 22,000 (higher than expected). Check:
- Is Et0/3, the root port, a 1 Gbps link (cost 20,000)?
- Is the upstream switch's root path cost 2,000 (one 10 Gbps hop)?
- Is the port cost manually overridden?
SW3# show spanning-tree vlan 1
...
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Root FWD 20000 128.4 P2pEt0/3 costs 20,000, the long value for 1 Gbps (modeled with spanning-tree cost in the second lab, with the direct link to SW1 shut). The root path cost of 22,000 therefore means SW2 advertises 2,000, the 10 Gbps value: its Po1 to the root.
Problem: Manual Cost Not Applied
If you set a cost manually but STP still chose a different path:
To test this, I closed the lab into a ring by enabling a fourth link, SW4 Et1/0 to SW1 Et1/0 (port ID 128.5, cost 4). SW4's root port moved to that direct link, SW3's Et0/3 became Alternate and blocking, and every other port forwarded:
SW1# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address aabb.cc00.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Desg FWD 4 128.2 P2p
Et1/0 Desg FWD 4 128.5 P2p
SW2# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 4
Port 2 (Ethernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address aabb.cc00.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/1 Root FWD 4 128.2 P2p
Et0/2 Desg FWD 4 128.3 P2p
SW3# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 8
Port 3 (Ethernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Root FWD 4 128.3 P2p
Et0/3 Altn BLK 4 128.4 P2p
SW4# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 4
Port 5 (Ethernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)
Address aabb.cc00.0400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Desg FWD 4 128.4 P2p
Et1/0 Root FWD 4 128.5 P2pThen I set cost 1 on SW4 Et0/3, the port toward SW3:
SW4(config)# interface ethernet 0/3
SW4(config-if)# spanning-tree cost 1
SW4(config-if)# end
SW4# show spanning-tree vlan 1 root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 4097 aabb.cc00.0100 4 2 20 15 Et1/0
SW4# show spanning-tree vlan 1 interface Ethernet0/3
Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Desg FWD 1 128.4 P2pThe override is on the interface, so why is the root path cost still 4 and the root port still Et1/0? Because a port cost only counts on the port that becomes the root port. Check the roles:
SW4# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 4
Port 5 (Ethernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)
Address aabb.cc00.0400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/3 Desg FWD 1 128.4 P2p
Et1/0 Root FWD 4 128.5 P2pEt0/3 is designated, not root; the root port is Et1/0, the direct link to SW1. (This image rejects the show spanning-tree vlan 1 brief keyword, so the plain command is the one to use.)
Et1/0 reaches the root at 0 + 4 = 4. Even at cost 1, Et0/3 would total 8 (SW3's root path cost) + 1 = 9, so it loses. The new cost only changes what SW4 advertises toward SW3. SW3 now sees 4 + 4 = 8 through SW4, the same as its path through SW2, and keeps Et0/3 as Alternate because SW2's bridge ID (24577) is lower than SW4's (28673):
SW3# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address aabb.cc00.0100
Cost 8
Port 3 (Ethernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Root FWD 4 128.3 P2p
Et0/3 Altn BLK 4 128.4 P2pThe lesson: a port cost changes the root path cost only when that port is, or becomes, the root port. Check the Role column before assuming an override took effect.

What's Next
Read Article 7: 802.1D vs PVST+ vs Rapid PVST+ vs MST - Comparing STP Variants to understand modern STP implementations and when to use each variant.
Related STP Articles
- STP Port Roles Explained: Root, Designated, Blocked, and Alternate
- How STP Works: Root Bridge Election, BPDUs, and the Spanning Tree Algorithm
- Understanding STP Timers: Hello, Forward Delay, and Max Age
- STP and EtherChannel: Spanning Tree Behavior with Port Channels