MQTT Data Usage & Overhead Calculator
Estimate the bytes used by MQTT PUBLISH traffic after QoS acknowledgments, MQTT 5 properties, TCP/IP headers, and TLS record overhead. The result also turns a monthly data allowance into the number of devices it can support at the entered message rate.
Fleet data per month (MB)807.84
- MQTT PUBLISH packet
- 125
- MQTT bytes per complete exchange
- 125
- Estimated network bytes per exchange
- 187
- Protocol and transport overhead
- 46.52%
- Data per device per day (MB)
- 0.27
- Average fleet bandwidth (kbit/s)
- 2.49
- Maximum devices within allowance
- 12
Exchange byte breakdown
| Item | Bytes |
|---|---|
| MQTT PUBLISH packet | 125 |
| QoS acknowledgment packets | 0 |
| MQTT exchange before transport headers | 125 |
| Transport headers per MQTT packet | 62 |
| Estimated network exchange | 187 |
Assumes each MQTT control packet fits in one TCP segment and one TLS record.
The estimate excludes TCP-only acknowledgments, retransmissions, keep-alives, connection setup, DNS, and carrier billing increments.
How to use this calculator
- Enter the encoded payload size and topic length in bytes.
- Choose the MQTT version and QoS level used by the devices.
- Enter the message rate, fleet size, IP version, TLS overhead, and billing-period length.
- Use the monthly allowance field to see how many matching devices fit within the plan.
How the MQTT data estimate is calculated
The calculator starts with the bytes in one MQTT PUBLISH packet. MQTT stores the PUBLISH variable header and payload length in the Remaining Length field, which uses a variable byte integer. Let L(x) be 1 byte when x <= 127, 2 bytes when x <= 16,383, 3 bytes when x <= 2,097,151, and 4 bytes up to the MQTT maximum of 268,435,455.
For a payload P, topic byte length T, QoS packet identifier length I, and MQTT 5 property section G, the PUBLISH Remaining Length is:
M = 2 + T + I + G + P
The two bytes before the topic hold the topic length. QoS 0 uses I = 0; QoS 1 and QoS 2 use I = 2. MQTT 3.1.1 uses G = 0. MQTT 5 uses G = L(X) + X, where X is the encoded property data. Even with no MQTT 5 properties, the property length field is still one byte.
The full PUBLISH packet is then U = 1 + L(M) + M. QoS 0 has no MQTT acknowledgment bytes. QoS 1 adds a four-byte PUBACK. QoS 2 adds PUBREC, PUBREL, and PUBCOMP, modeled as three four-byte packets. The MQTT exchange is E_mqtt = U + A.
To estimate network bytes, the calculator adds one IP header, one 20-byte TCP header, and the selected TLS record overhead for each MQTT control packet in the exchange. IPv4 uses a 20-byte IP header and IPv6 uses a 40-byte header. With K MQTT control packets, the network exchange is:
E = E_mqtt + K * (IP + TCP + TLS)
Daily data per device is E * messages per hour * 24 / 1,000,000. Monthly fleet data multiplies that value by devices and billing days. Average fleet bandwidth is E * messages per hour * devices * 8 / 3,600,000 kbit/s. Maximum devices is the floor of the monthly allowance bytes divided by one device's monthly bytes.
What moves the result most
Payload size, message rate, and device count usually dominate monthly data. Small sensor messages are different: a short payload can be smaller than the topic, headers, TLS tag, and QoS exchange. QoS 2 is useful when an application needs exactly-once delivery, but it turns one PUBLISH into a four-packet MQTT exchange before transport headers are counted.
Topic length also matters because it is carried in each PUBLISH unless the application uses MQTT 5 topic aliases, which this calculator does not model. Count UTF-8 bytes, not visible characters, when a topic contains non-ASCII text.
What this calculator leaves out
The transport estimate assumes each MQTT control packet fits in one TCP segment and one TLS record. A large PUBLISH can be segmented, which adds more IP and TCP headers than the one-segment estimate. The tool warns when the PUBLISH side of the exchange is larger than a typical 1,500-byte path MTU.
The estimate also excludes TCP-only acknowledgments, retransmissions, fragmentation, Ethernet or cellular framing, broker keep-alives, DNS, TCP connection setup, TLS handshakes, carrier billing increments, topic aliases, WebSocket framing, MQTT-SN, compression, subscriber fanout, and broker-to-client deliveries. Use packet captures or carrier records to calibrate the number before buying a large deployment plan.
Worked example
Suppose each device sends a 100-byte payload on a 20-byte topic once per minute, using MQTT 5.0, QoS 0, IPv4, and 22 bytes of TLS overhead per MQTT packet. MQTT 5 adds a one-byte property length field even with no properties, so the PUBLISH Remaining Length is 2 + 20 + 0 + 1 + 100 = 123 bytes. The fixed header is 1 byte and the Remaining Length field is 1 byte, so the PUBLISH packet is 125 bytes.
QoS 0 adds no MQTT acknowledgments, and one IPv4/TCP/TLS wrapper adds 20 + 20 + 22 = 62 bytes. Each exchange is therefore 187 network bytes. At 60 messages per hour, one device uses 0.26928 MB per day. A 100-device fleet over 30 days uses 807.84 MB per month, averages 2.49 kbit/s, and a 100 MB plan supports 12 devices at the same rate.
Common questions
How many bytes of overhead does MQTT add?
For a PUBLISH packet, MQTT adds a fixed header, a variable-length Remaining Length field, two bytes for the topic length, the topic itself, and sometimes a packet identifier and MQTT 5 properties. The calculator separates the MQTT bytes from IP, TCP, and TLS bytes so you can see where the overhead comes from.
How do MQTT QoS 0, 1, and 2 change data usage?
QoS 0 sends only the PUBLISH packet. QoS 1 adds a PUBACK response. QoS 2 uses PUBREC, PUBREL, and PUBCOMP, so this estimate counts four MQTT control packets in the exchange.
How is MQTT 5 overhead different from MQTT 3.1.1?
MQTT 5 PUBLISH packets include a property length field before the property data. That field is present even when there are zero property bytes. MQTT 3.1.1 has no PUBLISH property section, so the calculator ignores property bytes when that version is selected.
How much cellular data will an MQTT sensor use each month?
Monthly use is the estimated network bytes per exchange multiplied by messages per hour, 24 hours, billing days, and device count. Cellular invoices may be higher because carriers can count retransmissions, connection setup, keep-alives, radio framing, or minimum billing increments.
Why can measured traffic exceed the calculator estimate?
The estimate is a one-segment model for MQTT application traffic. Packet captures can include TCP acknowledgments, retransmissions, DNS, TLS handshakes, MQTT keep-alives, fragmentation, broker replies, and link-layer framing that are outside the calculator.
Do TLS, TCP acknowledgments, and keep-alive packets count toward a data plan?
Most metered network plans count the actual bytes carried by the network, not only MQTT payload bytes. This calculator includes a configurable TLS record overhead and TCP/IP headers for MQTT control packets, but it does not include TCP-only acknowledgments or MQTT keep-alive traffic.