redzilla
All tools
Layer 2

STP Cost / Root Bridge

Sum the STP path cost of a route to the root (by link speed, short and long IEEE 802.1t/w cost) and find the root bridge by priority and MAC among several switches.

Mode

Add one link per hop between your switch and the root. The total cost is the sum of them all.

redzilla.cl — stp
 
Long cost (802.1t/w)
32-bit · RSTP / MST · current
Short cost (legacy)
16-bit · classic STP
Links on the path
hops to the root
Long
Short

Per-link breakdown

Cost by speed table (IEEE)
SpeedShort cost (16-bit)Long cost (32-bit)
How STP / RSTP works

Long cost IEEE 802.1t/w (RSTP/MST) uses 32 bits: cost = 20·10¹² / bps. It is the default on modern gear.

Short cost Classic STP (16 bits) saturates early: any link ≥ 10 Gb stays at 2, which is why long cost is preferred.

Path cost Each switch picks its root port by the lowest cumulative cost to the root (sum of the links on the path).

Bridge ID priority (16 bits) + MAC (48 bits). Priority comes in multiples of 4096 (default 32768). Lowest priority wins; on a tie, the lowest MAC.

Runs locally in your browser · no sign-up · nothing leaves your browser

How it works

The tool has two modes. In path cost, you add the links along the path between your switch and the root (by speed, from 10 Mb to 100 Gb) and get the total cost on both scales: the long cost from IEEE 802.1t/w (32-bit, cost = 20·10¹² / bps, the one RSTP and MST use on modern gear) and the short cost from classic STP (16-bit: 100 for 10 Mb, 19 for 100 Mb, 4 for 1 Gb, 2 for 10 Gb and above).

In root bridge mode you enter several switches with their priority (multiples of 4096, between 0 and 61440, defaulting to 32768) and their MAC address. The Bridge ID packs the priority into the upper 16 bits and the MAC into the lower 48, and the lowest value wins the election: priority decides first and, on a tie, the lowest MAC, exactly as IEEE 802.1D defines.

Example: 3-link path (1 Gb + 1 Gb + 100 Mb)

  1. Long cost per link: 1 Gb → 20·10¹² / 10⁹ = 20,000; 100 Mb → 200,000.
  2. Total long cost: 20,000 + 20,000 + 200,000 = 240,000.
  3. Total short cost: 4 + 4 + 19 = 27. The 100 Mb link dominates the cost on both scales: upgrading it to 1 Gb pays off before touching anything else.

Frequently asked questions

What is the difference between STP short cost and long cost?
The short cost is the original 16-bit table from classic STP, which saturates early: every link of 10 Gb or faster costs 2, so it cannot tell 10, 40 and 100 Gb apart. The IEEE 802.1t/w long cost uses 32 bits with the formula 20·10¹² divided by the bps, so a 10 Gb link costs 2000 and a 100 Gb link costs 200. On networks with links above 1 Gb the long cost is the better choice, and it is the default in RSTP and MST.
How is the root bridge elected in STP?
The switch with the lowest Bridge ID wins, combining the priority (16 bits) and the MAC (48 bits). Priority is compared first: lowest wins. Only on a priority tie does the lowest MAC decide, which is usually the oldest device and rarely what you want: that is why setting a low priority (for example 4096) on the core switch is the standard recommendation.
Why must the STP priority be a multiple of 4096?
Because the 802.1t standard reserved the lower 12 bits of the priority field for the Extended System ID (the VLAN number in PVST+), leaving only 4 configurable bits. With 4 bits there are only 16 possible values: 0, 4096, 8192… up to 61440. If you try to configure any other value, the switch rejects it.
What happens if two paths to the root have the same cost?
The switch breaks the tie with additional criteria, in order: the lowest Bridge ID of the neighboring switch, then the lowest port priority and finally the lowest port number on the neighbor. The calculator gives you the accumulated cost of each path so you can first confirm whether there really is a tie.
Was this tool useful?
Disclaimer We take great care to keep every tool accurate and review it thoroughly; even so, we can't guarantee it is free of errors or take responsibility for how the results are used. We recommend double-checking anything critical.
Found an error? Let us know →