STP Cost Calculation Methods
Port costs for STP have been modified to accommodate larger interface speeds. Originally, they were calculated using the formula 1Gbps/bandwidth using a 16-bit number. This is called short mode. To accommodate the higher speeds available today and in the future, this has been modified to the use of a 32-bit number with the formula 20 Tbps / bandwidth. This is called long mode.
You can configure a switch to use either the short or long mode using the spanning-tree pathcost method
command.
Most modern switches use the long path cost method by default.
Links
https://forum.networklessons.com/t/spanning-tree-cost-calculation/1111/97?u=lagapides