Protocol Overhead Calculator
Try Change Payload size (bytes) to 1 and select a Protocol stack.
Observe Watch Total packet size, Efficiency, and Overhead ratio after pressing Calculate.
Explain Explain why a 1-byte payload suffers disproportionately from protocol overhead.
Calculate
Reset
Technical boundaries. The LoRaWAN case assumes four FOpts bytes; CoAP includes its payload marker but no token or options. Link framing, radio airtime, security and retries are excluded.
viewof payload_size = Inputs. range ([1 , 500 ], {value : 12 , step : 1 , label : "Payload size (bytes)" })
viewof protocol = Inputs. select (
["LoRaWAN MAC (13B header + 4B MIC)" , "MQTT 3.1.1 QoS 0 / TCP / IPv4 (topic a/b)" , "CoAP / UDP / IPv4 (no token or options)" , "Custom (set below)" ],
{label : "Protocol stack" , value : "LoRaWAN MAC (13B header + 4B MIC)" }
)
viewof custom_overhead = Inputs. range ([0 , 200 ], {value : 40 , step : 1 , label : "Custom header overhead (bytes)" })
overhead_bytes = {
if (protocol === "LoRaWAN MAC (13B header + 4B MIC)" ) return 17 ;
if (protocol === "MQTT 3.1.1 QoS 0 / TCP / IPv4 (topic a/b)" ) return 47 ;
if (protocol === "CoAP / UDP / IPv4 (no token or options)" ) return 33 ;
return custom_overhead;
}
total_packet = payload_size + overhead_bytes
efficiency_pct = (payload_size / total_packet * 100 ). toFixed (1 )
overhead_pct = (overhead_bytes / total_packet * 100 ). toFixed (1 )
html `<div style="background: #f8f9fa; border-left: 3px solid #16A085; padding: 1em; border-radius: 4px; margin-top: 0.5em;">
<table style="width:100%; border-collapse: collapse;">
<tr><th scope="col" style="text-align:left; padding: 4px 8px;">Packet quantity</th><th scope="col" style="text-align:left; padding: 4px 8px;">Value</th></tr>
<tr><td style="padding: 4px 8px;"><strong>Payload</strong></td><td style="padding: 4px 8px;"> ${ payload_size} bytes</td></tr>
<tr><td style="padding: 4px 8px;"><strong>Header overhead</strong></td><td style="padding: 4px 8px;"> ${ overhead_bytes} bytes</td></tr>
<tr><td style="padding: 4px 8px;"><strong>Total packet size</strong></td><td style="padding: 4px 8px;"> ${ total_packet} bytes</td></tr>
<tr style="border-top: 1px solid #ccc;"><td style="padding: 4px 8px;"><strong>Efficiency</strong></td><td style="padding: 4px 8px; color: ${ efficiency_pct > 70 ? '#16A085' : efficiency_pct > 40 ? '#E67E22' : '#E74C3C' } ;"> ${ efficiency_pct} % useful data</td></tr>
<tr><td style="padding: 4px 8px;"><strong>Overhead ratio</strong></td><td style="padding: 4px 8px;"> ${ overhead_pct} %</td></tr>
</table>
<div style="margin-top: 0.5em;">
<div style="background: #e0e0e0; border-radius: 4px; height: 24px; position: relative;">
<div style="background: #16A085; border-radius: 4px 0 0 4px; height: 100%; width: ${ efficiency_pct} %; display: inline-block; text-align: center; color: white; font-size: 12px; line-height: 24px;"> ${ payload_size} B payload</div>
<div style="background: #E67E22; border-radius: 0 4px 4px 0; height: 100%; width: ${ overhead_pct} %; display: inline-block; text-align: center; color: white; font-size: 12px; line-height: 24px; position: absolute; right: 0; top: 0;"> ${ overhead_bytes} B headers</div>
</div>
</div>
<p style="margin-top: 0.5em; font-size: 0.9em; color: #666;">Smaller payloads suffer disproportionately from protocol overhead. The LoRaWAN case assumes four FOpts bytes. The CoAP case includes its 1-byte payload marker; actual requests usually add options. Link framing, radio airtime, security and retries are excluded. Try a 1-byte payload.</p>
</div>`
Back to the chapter