Calculate Committed Burst (Bc) and Excess Burst (Be) based on CIR and Tc.
The guaranteed bandwidth you want to shape.
Select the unit for CIR.
Kbps (Kilobits/sec)
Mbps (Megabits/sec)
Gbps (Gigabits/sec)
The time slice for token replenishment (Cisco default often 125ms).
milliseconds (ms)
Please enter valid positive numbers.
Configuration Parameters
Target Rate (bps):0 bps
Committed Burst (Bc) in Bits:0 bits
Committed Burst (Bc) in Bytes:0 bytes
Rec. Excess Burst (Be) (1x Bc):0 bytes
Max Burst Duration (at Line Rate):Depends on Physical Link
Understanding Traffic Shaping and Policing
Traffic shaping (and policing) is a critical component of Quality of Service (QoS) in network engineering. It allows administrators to control the flow of data packets to ensure bandwidth compliance, prevent congestion, and meet Service Level Agreements (SLAs). Unlike policing, which drops excess packets immediately, traffic shaping buffers excess packets and releases them over time to smooth out the traffic rate.
The Token Bucket Algorithm
Most network devices, including Cisco routers, use the Token Bucket Algorithm to measure traffic rates. Imagine a bucket that fills with tokens at a specific rate. Each token allows a specific number of bits to pass through the interface.
CIR (Committed Information Rate): The average rate of traffic transfer guaranteed by the provider (e.g., 10 Mbps). This is how fast tokens are put into the bucket.
Tc (Time Interval): The frequency at which tokens are added to the bucket. A standard default is often 125 milliseconds (0.125 seconds).
Bc (Committed Burst Size): The maximum amount of data (in bits or bytes) that can be sent during one time interval ($T_c$). This represents the capacity of the bucket.
How to Calculate Burst Size (Bc)
When configuring a router, you typically know the CIR (the speed you bought) and the Tc (the router's internal clock tick for QoS). You need to calculate the Burst Size ($B_c$) to configure the shaping command correctly.
Formula: Bc (bits) = CIR (bps) × Tc (seconds)
For example, if you want to shape traffic to 10 Mbps with a 125 ms interval:
Convert to Bytes (optional but common in configs): $1,250,000 / 8 = 156,250$ Bytes.
Setting Excess Burst (Be)
The Excess Burst ($B_e$) allows the router to "borrow" credits from previous idle time intervals to burst above the CIR briefly. A common recommendation is to set $B_e$ equal to $B_c$ for standard shaping, or $2 \times B_c$ if the application tolerates higher jitter but needs burstiness.
Why Use This Calculator?
Manual conversion between Gigabits, Megabits, and Kilobits, combined with the conversion from bits to bytes for router configuration commands (like traffic-shape rate or police), is prone to error. This calculator ensures precise values for your QoS policy maps, helping maintain stable network performance.
function calculateShaping() {
// 1. Get Elements
var cirInput = document.getElementById('cirInput');
var cirUnit = document.getElementById('cirUnit');
var tcInput = document.getElementById('tcInput');
var resultContainer = document.getElementById('resultContainer');
var errorMsg = document.getElementById('errorMsg');
// 2. Get Values
var cirVal = parseFloat(cirInput.value);
var unitVal = parseFloat(cirUnit.value);
var tcValMs = parseFloat(tcInput.value);
// 3. Validation
if (isNaN(cirVal) || isNaN(tcValMs) || cirVal < 0 || tcValMs = 1000000000) return (num / 1000000000).toFixed(2) + ' Gbps';
if (num >= 1000000) return (num / 1000000).toFixed(2) + ' Mbps';
if (num >= 1000) return (num / 1000).toFixed(2) + ' Kbps';
return num.toFixed(0) + ' bps';
}
// 6. Update Display
document.getElementById('resBps').innerHTML = formatBits(targetBps);
document.getElementById('resBcBits').innerHTML = formatNumber(bcBits) + " bits";
document.getElementById('resBcBytes').innerHTML = formatNumber(bcBytes) + " bytes";
document.getElementById('resBeBytes').innerHTML = formatNumber(beBytes) + " bytes";
// Show results
resultContainer.style.display = 'block';
}