· 7 min read

95th Percentile Billing: How to Calculate It, With Example

95th percentile billing (also called burstable billing) measures your bandwidth in 5-minute samples over a month, throws away the highest 5% of samples, and bills you at the highest value that remains. In practice this means short traffic spikes totaling up to about 36 hours in a 30-day month cost you nothing extra, while sustained high usage does.

This guide shows exactly how the number is calculated, gives a worked example, includes scripts you can use to verify an invoice, and lists the mistakes that cause disputes.

How 95th percentile billing works

The method has five steps:

  1. Sample. The provider polls the interface counter on your port every 5 minutes (300 seconds) and converts the counter difference into an average rate in bits per second.
  2. Collect. Over a 30-day month that produces 30 × 288 = 8,640 samples.
  3. Sort. All samples are sorted from lowest to highest.
  4. Discard. The top 5% are ignored. For 8,640 samples that is 432 samples, which equals 36 hours.
  5. Bill. The highest remaining sample (rank 8,208 in the ascending list) is your billable rate.

The same logic applies to a 31-day month, only the numbers change: 8,928 samples, with the 95th percentile at rank ceil(0.95 × 8,928) = 8,482.

Which direction is billed?

This is defined in your contract, not by the math. Common models:

Model How the billable rate is chosen
Greater of in/out Compute 95th percentile for inbound and outbound separately, bill the larger
Outbound only Only egress is measured (common for content hosting)
Sum (in + out) Add the two directions per sample, then take the 95th percentile
Separate Each direction is billed on its own

Hosting and game server workloads are usually outbound-heavy, so "greater of" and "outbound" often give the same result. Check the contract rather than assuming.

A small worked example

To see the mechanics, use 20 samples (imagine each is one measurement, in Mbps). 5% of 20 is 1, so one sample is dropped.

Samples in time order:

180, 210, 190, 205, 900, 220, 195, 200, 185, 215, 230, 240, 210, 200, 190, 225, 235, 205, 210, 195

Sorted ascending:

180, 185, 190, 190, 195, 195, 200, 200, 205, 205, 210, 210, 210, 215, 220, 225, 230, 235, 240, 900

The top sample (900) is discarded. The highest remaining value is 240 Mbps, so the bill is based on 240 Mbps, even though the peak hit 900.

Burst versus sustained traffic at full scale

Take a 30-day month with a 200 Mbps baseline:

The lesson: 95th percentile rewards spiky traffic and punishes long plateaus. A single day-long event can be absorbed. A multi-day campaign cannot.

Collect the data yourself with SNMP

You do not need to rely only on the provider's graphs. Poll the switch or router port facing your server (or your own server's interface) every 5 minutes.

Use the 64-bit counters (ifHCInOctets, ifHCOutOctets). 32-bit counters wrap in under a minute on a busy gigabit link and will corrupt your samples.

# Find the interface index
snmpwalk -v2c -c public 192.0.2.1 IF-MIB::ifName

# Read 64-bit counters for ifIndex 12
snmpget -v2c -c public 192.0.2.1 \
  IF-MIB::ifHCInOctets.12 IF-MIB::ifHCOutOctets.12

If you only have a Linux host, a cron job reading /proc/net/dev or /sys/class/net/eth0/statistics/tx_bytes every 5 minutes works the same way. Log a Unix timestamp with each reading:

# /etc/cron.d/bwlog  (runs every 5 minutes)
*/5 * * * * root echo "$(date +\%s) $(cat /sys/class/net/eth0/statistics/rx_bytes) $(cat /sys/class/net/eth0/statistics/tx_bytes)" >> /var/log/bw-counters.log

Convert counters to Mbps

awk 'NR>1 {
  dt = $1 - pt
  if (dt > 0 && $2 >= pr && $3 >= px) {
    printf "%d %.2f %.2f\n", $1, ($2-pr)*8/dt/1e6, ($3-px)*8/dt/1e6
  }
}
{ pt=$1; pr=$2; px=$3 }' /var/log/bw-counters.log > rates.txt

The output columns are timestamp, inbound Mbps, outbound Mbps. The >= checks skip samples where a counter reset (for example after a reboot) so they do not produce giant negative or wrapped values.

Calculate the 95th percentile

For a single column of values in Mbps (here, outbound):

awk '{print $3}' rates.txt | sort -n | awk '
{ a[NR] = $1 }
END {
  i = NR * 0.95
  if (i > int(i)) i = int(i) + 1
  printf "Samples: %d  95th percentile: %.2f Mbps\n", NR, a[i]
}'

Or in Python, handling "greater of in/out":

import math

ins, outs = [], []
for line in open("rates.txt"):
    _, rx, tx = line.split()
    ins.append(float(rx)); outs.append(float(tx))

def p95(values):
    values = sorted(values)
    rank = math.ceil(len(values) * 0.95)
    return values[rank - 1]

print("in :", p95(ins))
print("out:", p95(outs))
print("billable (greater of):", max(p95(ins), p95(outs)), "Mbps")

This uses the nearest-rank method, which is the most common convention. Some billing systems interpolate or round differently, so a difference of a fraction of a percent is normal. A large gap is not.

Commit rate and overage

Many contracts combine a commit (a minimum billable rate) with burst billing above it. For example, with a 500 Mbps commit, a month with a 95th percentile of 240 Mbps is billed at the 500 Mbps commit. A month at 620 Mbps is billed at 620 Mbps, or at commit plus an overage rate, depending on the contract terms.

Also separate two ideas that are easy to confuse:

Bursting is limited by port speed, not by the commit.

Common mistakes and how to fix them

Using 32-bit counters. Symptoms are impossible spikes or zeros. Switch to ifHC* OIDs.

Mixing bits and bytes. SNMP octet counters are bytes. Multiply by 8 for bits. Forgetting this understates usage by 8×.

Wrong interval. If your poller runs every 60 seconds and the provider uses 5 minutes, your 95th percentile will be higher because shorter intervals show sharper peaks. Aggregate to 5-minute averages before comparing.

Time zone and month boundaries. Billing periods usually follow UTC or a fixed calendar month. If your script uses local time, your first and last samples differ. Confirm the period start and end in the contract.

Missing samples. Poller outages create gaps. Providers handle gaps differently (skip, or count as zero), which shifts the percentile. Ask how it is handled.

Counting attack traffic. Volumetric DDoS can push you into the billable plateau without any real customer demand. Ask whether measurement happens before or after filtering, and whether attack traffic is excluded. Putting mitigation upstream of your billed port, such as DDoS protection and firewall, keeps junk traffic from inflating your usage.

Megabit definition. Network billing normally uses decimal units (1 Mbps = 1,000,000 bits/s). Using 1,048,576 changes the result by about 5%.

Ways to lower a 95th percentile bill

Monitor it continuously

Calculating the number once a month is reactive. Keep per-interface and per-prefix traffic history and watch how many samples above your commit have accumulated. Flow-based tools help you find which destination, port, or customer is responsible for a plateau. NixMon provides flow-based network monitoring and DDoS detection, which is useful when you need to separate legitimate growth from abnormal traffic before it affects a burstable bill.

Quick checklist for verifying an invoice

  1. Confirm the billing period and time zone.
  2. Confirm which direction(s) are billed.
  3. Confirm the sampling interval (normally 5 minutes).
  4. Export the provider's sample data if available.
  5. Recompute with the script above.
  6. Compare. Small differences come from rounding. Large differences point to counter, interval, or period issues.

Frequently asked questions

How many samples are discarded in 95th percentile billing?

The top 5%. In a 30-day month with 5-minute samples there are 8,640 samples, so 432 are discarded, which equals 36 hours of your highest traffic.

Is 95th percentile the same as average bandwidth?

No. Average bandwidth is the mean of all samples. The 95th percentile is a high-water mark after ignoring the top 5% of samples, so it is almost always higher than the average and lower than the absolute peak.

Can I get billed for traffic caused by a DDoS attack?

It depends on the contract and where measurement happens. If attack traffic reaches your billed port, it can raise your 95th percentile. Ask whether usage is measured before or after filtering, and use upstream mitigation to reduce the effect.

Which SNMP counters should I use to calculate it?

Use the 64-bit counters ifHCInOctets and ifHCOutOctets from IF-MIB. The 32-bit counters wrap too quickly on fast links and give wrong samples.

Need traffic visibility before the invoice? Explore NixMon monitoring.Learn more