MQTT packet size & bandwidth calculator

See exactly how many bytes an MQTT PUBLISH takes on the wire — header, topic, properties, payload and QoS acknowledgements — and what your whole fleet sends per day and per month.

Protocol version
QoS
Payload
47 bytes as UTF-8
PUBLISH packet89 B42 B protocol overhead (47%)
Per message incl. acks93 Bone hop, 4 B of acks
Fleet per month8.04 GB43,200,000 messages published

PUBLISH packet breakdown

FieldBytes
Fixed header (packet type + flags)1
Remaining Length — variable byte integer, 1–4 bytes1
Topic length prefix2
Topic name (UTF-8)35
Packet identifier — QoS 1 and 2 only2
Property length — MQTT 5 variable byte integer1
Properties0
Payload47
PUBLISH total89
PUBACK — acknowledgement4
Total incl. acknowledgements93

Fleet bandwidth

TrafficPer dayPer month
Devices → broker
PUBLISH in, acks out
134 MB4.02 GB
Broker → subscribers (×1)
each delivery is a new PUBLISH
134 MB4.02 GB
Total MQTT traffic268 MB8.04 GB
One device → broker134 KB4.02 MB

1 KB = 1,000 bytes; a month is 30 days. Acks assume the minimal 4-byte form (in MQTT 5 a success ack without properties may omit the reason code). Subscriber deliveries assume the same topic and QoS. TCP/IP, TLS and WebSocket framing are not included — see the notes below.

Anatomy of an MQTT PUBLISH packet

Every MQTT packet starts with a fixed header: one byte holding the packet type and flags (for PUBLISH: DUP, QoS and RETAIN), followed by the Remaining Length — the number of bytes that follow, encoded as a variable byte integer. Values up to 127 take one byte, up to 16,383 two bytes, up to 2,097,151 three bytes and up to 268,435,455 four bytes.

The variable header of a PUBLISH contains the topic name, prefixed with a 2-byte length, and — only for QoS 1 and 2 — a 2-byte packet identifier. In MQTT 5 it also carries a property length (another variable byte integer, at least one byte even when there are no properties) and the properties themselves, such as Message Expiry Interval, Content Type or User Properties. Everything after that is payload: MQTT does not add a length prefix to it, because its size is implied by the Remaining Length.

Why topic names matter for bandwidth

The topic name is sent in full with every single message. A topic like factory/line-1/sensor-042/telemetry costs 35 bytes — often more than a compact sensor payload. For a fleet sending every few seconds, shortening topics is one of the cheapest optimisations there is. MQTT 5 also offers topic aliases: after the first message, the client can send a 2-byte alias number (a 3-byte property) instead of the topic string. Read more about structuring topics in the MQTT topics and wildcards guide.

QoS and acknowledgements

QoS 0 is fire-and-forget: no packet identifier and no acknowledgement. QoS 1 adds a 2-byte identifier and a 4-byte PUBACK. QoS 2 uses a four-step handshake — PUBLISH, PUBREC, PUBREL, PUBCOMP — adding 14 bytes and a full extra round trip per message. Acknowledgements happen on each hop: between the publisher and the broker, and again between the broker and every subscriber, using the lower of the publish QoS and the subscription QoS. The QoS levels guide explains when the extra cost is worth it.

What the calculator does not count

Real network usage is higher than the MQTT byte count. Each TCP segment carries 40 bytes of IPv4 + TCP headers (60 with IPv6), and more with TCP options. TLS adds a record header, MAC/tag and padding of roughly 22–29 bytes per record, plus a few kilobytes for every handshake. MQTT over WebSockets adds a 2–14 byte frame header per message. On top of that, idle connections exchange 2-byte PINGREQ/PINGRESP packets every keep alive interval — see MQTT keep alive.

Want to verify the numbers? Publish the same message in the online MQTT client and inspect it, or new to the protocol? Start with what is MQTT. If your broker rejects large messages with reason code 0x95, compare the packet size with its maximum packet size setting.

Packet size FAQ

What is the minimum size of an MQTT message?

A QoS 0 PUBLISH in MQTT 3.1.1 with a one-character topic and an empty payload is 5 bytes: 1 byte fixed header, 1 byte remaining length, 2 bytes topic length and 1 byte topic. MQTT 5 adds at least one byte for the property length.

What is the maximum MQTT message size?

The Remaining Length field can encode up to 268,435,455 bytes (about 256 MB), so that is the protocol limit. In practice brokers set much lower limits — often a few hundred kilobytes to a few megabytes — and MQTT 5 clients and brokers can announce a Maximum Packet Size.

How much bandwidth does QoS 1 or QoS 2 add?

QoS 1 adds a 2-byte packet identifier to the PUBLISH plus a 4-byte PUBACK, so 6 bytes per message. QoS 2 adds the same identifier plus PUBREC, PUBREL and PUBCOMP, for 14 bytes per message, and an extra round trip.

Does this include TLS and TCP overhead?

No. The calculator counts MQTT bytes only. TCP/IP headers add roughly 40–52 bytes per segment, TLS adds about 22–29 bytes per record, and WebSockets add 2–14 bytes per frame. For small messages this overhead can be larger than the MQTT packet itself.

From the makers of TestMQTT

Know your traffic? Pick a broker that fits it

Public test brokers are shared with thousands of strangers. ConnectMQ gives you a private MQTT broker you can trust with real devices — set up in minutes.

  • Your own isolated broker — nobody else can read your topics
  • Username / password auth and per-topic access control
  • TLS and secure WebSockets, MQTT 3.1.1 and MQTT 5
  • Same client code from first test to production