MQTT Packet Size Calculator for IoT Bandwidth

June 25, 2026

MQTT Packet Size Calculator

Estimate MQTT PUBLISH packet bytes, variable header growth, QoS acknowledgment traffic, TCP/IP and TLS record overhead, publish rate, and broker fan-out bandwidth.

📡IoT traffic presets

⚙MQTT message inputs

UTF-8 bytes in the PUBLISH topic name, before payload.

Use the encoded JSON, CBOR, binary, or text payload size.

Included in connect-session estimate, not every publish packet.

Retain changes the fixed header flag, not the packet length.

Connect estimate includes client ID and clean-session behavior.

MQTT publish packet 0 bytes before TCP/TLS
Wire size per message 0 bytes with transport overhead
Publisher upstream 0 kbps including QoS ack traffic
Broker fan-out 0 kbps to subscribers
MQTT fixed header and remaining length0 bytes
Variable header: topic, packet id, properties0 bytes
Payload and retain flag0 bytes
Transport overhead per publish0 bytes
QoS acknowledgment flow0 bytes per publish
Broker interpretationReady

📊MQTT packet component grid

1 Bfixed header control byte
1-4 Bremaining length field
+2 Btopic length prefix
+2 BQoS 1/2 packet id
40 BTCP/IPv4 minimum
60 BTCP/IPv6 minimum
22-39 Btypical TLS record
14 BEthernet header only

📦MQTT PUBLISH byte breakdown table

Component Bytes Applies when Notes
Control packet type and flags1Every PUBLISHIncludes DUP, QoS bits, and retain flag.
Remaining length field1 to 4Every MQTT packetGrows at 128, 16,384, and 2,097,152 bytes.
Topic name length prefix2Every PUBLISHTwo-byte integer before the UTF-8 topic.
Topic name bytesInputEvery PUBLISHLong hierarchy names can dominate tiny payloads.
Packet identifier2QoS 1 or QoS 2Needed so acknowledgments match the message.
Property length and propertiesInputMQTT 5 onlyUser properties, topic alias, expiry, and metadata.
Application payloadInputEvery PUBLISHJSON, binary telemetry, state, command, or event data.

🖧MQTT control packet grid

Control packet Typical base size Traffic direction Bandwidth impact
CONNECT16 B plus client IDClient to brokerSession setup only, not per publish.
CONNACK4 BBroker to clientSmall one-time reply per connection.
PUBLISH QoS 0Payload plus topicEither directionLowest packet count, no MQTT ack.
PUBLISH QoS 1QoS 0 plus 2 B idEither directionAdds PUBACK packet for each publish.
PUBLISH QoS 2QoS 1 sizeEither directionAdds PUBREC, PUBREL, and PUBCOMP flow.
SUBSCRIBE7 B plus topicClient to brokerSetup traffic; can include many filters.
PINGREQ / PINGRESP2 B eachBoth directionsKeepalive bytes, often negligible.
DISCONNECT2 B or moreEither directionMQTT 5 reason and properties can add bytes.

🌐Transport overhead reference

Transport model Added bytes What is included Use for
TCP over IPv440 B20 B IPv4 plus 20 B TCPPlain MQTT on port 1883 across IPv4.
TLS over TCP/IPv469 BIPv4, TCP, TLS header, tag, padding estimateCommon MQTTS on port 8883.
TCP over IPv660 B40 B IPv6 plus 20 B TCPPlain MQTT on IPv6 networks.
TLS over TCP/IPv689 BIPv6, TCP, and TLS record estimateEncrypted IPv6 home lab or WAN path.
Ethernet plus TLS/IPv483 BEthernet header plus TLS/IPv4 modelApproximate LAN wire capture sizing.
VPN plus TLS/IPv4129 BTLS/IPv4 plus overlay tunnel estimateRemote brokers behind WireGuard or IPsec.

🏠Common MQTT project sizes

Project Typical payload Publish pattern Bandwidth note
Temperature sensors20 to 80 BEvery 30 to 300 secondsTopic length can exceed payload size.
Energy monitor120 to 600 BEvery 1 to 10 secondsQoS 1 ack traffic is usually acceptable.
Camera motion events200 B to 2 KBBurst trafficBroker fan-out matters more than ingest.
Home Assistant discovery600 B to 4 KBRetained setup messagesRetained packets affect broker storage.
GPS fleet tracking80 to 250 BEvery 1 to 30 secondsCellular billing rewards compact payloads.
Industrial telemetry64 B to 1 KBSteady and frequentQoS, TLS, and subscribers set capacity.
MQTT sizing tip: For very small sensor messages, long topics, MQTT 5 properties, TLS, and QoS acknowledgments can outweigh the payload by several times.
Broker tip: Publisher bandwidth is only the ingest side. Multiply the wire message size by matching subscribers to estimate broker egress pressure.

When you design a system using the MQTT protocol, you have to consider the amount of traffic that each device will generates. The amount of traffic that each device generates will determine the data plan cost, the gateway capacity, and the capacity left for an MQTT broker. The size of the packets that is sent from each device is one of the major factor that will contribute to these calculations, but it is possible that you may underestimate the size of the packets due to the fact that only the payload size of the packet is considered.

The total size of the MQTT publish packet include the fixed header, the topic string that is published, the packet identifier that is required according to the Quality of Service of the publish, and the optional MQTT 5 properties. Additionally, the total size of the publish packet includes the transport overhead, such as 40 byte of overhead for TCP and IPv4 protocols, and even more overhead if the MQTT communication over TCP is protected with TLS. Such transport overhead does not change with the size of the payload that is sent.

Calculate MQTT message size and data use

The calculator consider each of these factors as inputs. For example, the length of the MQTT topic can have a major impact on the size of the publish packet, as it is possible for a topic to be larger than the payload. Additionally, the size of the payload that is sent can change based on the encoding scheme for that payload.

JSON is one method of making the payload easily readable to humans, but CBOR may be a better choice for applications that seek to minimize the size of the payload. Additionally, the Quality of Service can impact the size of the MQTT communication, as higher Quality of Service levels will require that MQTT acknowledge the messages to ensure they are delivered. As such, higher Quality of Service settings will result in more messages transmitted over the link.

Additionally, the settings for transport protocols allow for plain TCP or TLS protocols, as well as IPv4 or IPv6 protocols, so that the MQTT system can be configured according to the network that will be used. Beyond the size of the packets that each device publishes, additional factor must be considered in order to calculate the total bandwidth that will be utilized by the system. Factors such as the message rate, the number of devices, and the subscriber count will help to calculate the total bandwidth that will be used by the system.

For instance, if the size of a retained message is 2 KB but there are 20 dashboards that are subscribed to the same topic, the size of the message will be 40 KB of egress data. Additionally, it is also important to use a buffer percentage in the calculations in order to account for network jitter and packet retransmissions. Using a buffer of 10 or 15 percent will ensure that you account for these types of network issue.

It is likely that many people will not consider the size of the packets until after they have deployed the MQTT devices. For instance, while a temperature sensor may appear to emit very little data, the size of it’s data plans may turn out to be costly once the size of the TLS and topic string overhead are added to the data it publishes. Additionally, a fleet of GPS trackers that appears to work well at a certain publish rate may become an issue for the uplink if the number of GPS trackers increases.

However, by using the calculator to determine the impact of each of these factor, the issues can be avoided prior to purchasing the hardware that will be used to deploy the MQTT system. It may be possible to reduce the size of the packets that devices publish through the use of shorter MQTT topics or by using a Quality of Service of 0. However, reducing the size of the topics may make it more difficult to manage the system as it expands.

Additionally, using a Quality of Service of 0 means that any messages that are not delivered will not be recovered. MQTT 5 allows for topics to be aliased such that the repeated transmission of the same topic is avoided, but only if both the clients and the MQTT broker support MQTT 5. Additionally, the size of the messages that are published can include messages that the MQTT broker retains.

These messages will remain in the memory of the broker until the device that published the message clears them. Additionally, if those messages continue to grow in size due to the addition of fields for new information, the storage cost of the MQTT broker will increase. While the MQTT packet size calculator does not account for storage cost of the MQTT broker, the retained flag is one of the inputs to the calculator so that the MQTT system designer remembers to account for this type of cost for the system outside of the MQTT bandwidth calculations.

Finally, the use of cellular networks introduces additional factors into the considerations for the MQTT system. For instance, each of the cellular network carriers will bill for data in small increments of data, and many will throttle the data rate of a device after a daily data cap. Thus, a device that sends 200 bytes every 10 seconds may seem small, but if that data is multiplied by the TLS, TCP, and the number of devices that are using the system, it may become an issue.

Additionally, the publish rate at which the devices are set up will impact how many devices can remain within a specific data tier. Additionally, security settings will have an impact on the data rates. For instance, using mutual TLS with certificate pinning will add to the initial handshake data, but subsequent handshakes will be smaller.

Additionally, if the MQTT messages are transmitted through a VPN, the additional headers will impact the size of the data that is transmitted. It is important to calculate the number of data units that will be transmitted each worst-case hour instead of the average minute for each device. For instance, each device may be utilizing very little data for most of the hour, but it is possible that it will emit a burst of data during the same time period as other devices are active on the network.

If the MQTT broker is calculated to reach the uplink limit during the worst-case scenario, it may be necessary to introduce buffering for the devices or to reduce the size of any retained message that are published by the devices. By calculating the size of the messages that the devices are to be published, it is certain that the cost and reliability of the system will remain the same when the devices are online and publishing messages.

MQTT Packet Size Calculator for IoT Bandwidth

Related posts

Leave a Comment