MQTT 5.0 Decoder
Decode all 15 MQTT 5.0 packet types in your browser, inspect properties and reason codes, trace exact bytes and export payloads.
Data is processed only in your browserHow to use
MQTT 5.0 Decoder turns raw MQTT wire data into an inspectable packet stream and covers all 15 packet types. It reads the fixed header, Remaining Length, Packet Identifier, Topic, Properties, Reason Code and Payload while retaining the exact byte range of every field. Hover or click between the decoded tree and hex map, or click a diagnostic offset to jump straight to the bytes. Everything runs in your browser: no broker connection and no packet uploads.
How to use: paste MQTT bytes after removing TLS, WebSocket or other transport framing, in hex or Base64, or upload a binary file up to 2 MB. Remaining Length automatically splits consecutive packets. Use the packet overview to switch packets, the tree for full structure, and the PUBLISH payload panel for text or hex preview, copy and binary download. Export the whole decode as JSON. Inputs are never added to the address bar automatically. To reproduce them, use “Share link” to copy a link containing the original packets (up to 6,000 bytes), and share only non-sensitive data.
Supported packet types
| Group | Packets | Key fields |
|---|---|---|
| Connection and authentication | CONNECT, CONNACK, AUTH | Protocol level, Keep Alive, Will, authentication method, session parameters |
| Publish and acknowledgement | PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP | QoS, DUP, RETAIN, Packet Identifier, payload, reason code |
| Subscriptions | SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK | Topic Filter, subscription options, granted QoS, shared subscriptions |
| Connection maintenance | PINGREQ, PINGRESP, DISCONNECT | Empty packets, disconnect reason, session and server properties |
Fixed header and Remaining Length
The first fixed-header byte stores the packet type in its high nibble and flags in its low nibble. Flags are fixed for every type except PUBLISH; PUBREL, SUBSCRIBE and UNSUBSCRIBE use 0x2. PUBLISH flags carry RETAIN, QoS and DUP: QoS 3 is invalid, and DUP must be zero at QoS 0.
Remaining Length is a Variable Byte Integer of at most four bytes, with a maximum value of 268,435,455. The tool uses it as the packet boundary, so a malformed body can still be followed by successfully decoded packets when that boundary remains reliable.
MQTT 5.0 property validation
| Property group | Examples | Checks |
|---|---|---|
| Published content | Payload Format Indicator, Content Type, Response Topic, Correlation Data | Packet context, UTF-8, topic wildcards, payload format |
| Session and limits | Session Expiry Interval, Receive Maximum, Maximum Packet Size, Topic Alias Maximum | Numeric ranges, non-zero values, allowed context |
| Topics and subscriptions | Topic Alias, Subscription Identifier, Maximum QoS, Retain Available | Non-zero alias, Subscription Identifier repetition rules |
| Authentication and diagnostics | Authentication Method / Data, Reason String, User Property | Authentication dependencies, multiplicity, UTF-8 string pairs |
Omitted fields in short packets
At Remaining Length 2, PUBACK / PUBREC / PUBREL / PUBCOMP contain only Packet Identifier; Reason Code and Property Length are implicitly zero. At length 3, Reason Code is present and Property Length remains implicitly zero. At length 4 or more, Property Length and Properties are explicit. DISCONNECT may omit both at length 0, or contain only Reason Code at length 1. AUTH permits the combined omission only when Reason Code is Success and there are no properties, giving length 0.
Shared subscriptions
In $share/{ShareName}/{filter}, ShareName must be non-empty and contain no /, + or #, and a valid Topic Filter must follow. ShareName does not participate in published-topic matching. No Local must be zero on a shared subscription. UNSUBSCRIBE carries Topic Filters, so + and # are valid there.
Troubleshooting and boundaries
Length overrun? Check the Variable Byte Integer encoding of Remaining Length plus every string and property length. Truncated input keeps the fields decoded before the gap and marks the missing boundary.
Unknown property stops property decoding? An unknown property id carries no standalone type information. The tool conservatively marks the remaining property bytes as unknown and reports an error instead of guessing their length. Confirm the id against the MQTT 5.0 specification.
Can it validate a session? No. It checks individual wire structures and cross-property rules, but does not reconstruct full session state, packet ordering, cross-packet Topic Alias bindings, authorization or TLS content, and it does not unpack PCAP containers. When Payload Format Indicator is 1, payload bytes must be well-formed UTF-8.
Frequently asked questions
Which MQTT packets are supported?
All 15 MQTT 5.0 packet types: CONNECT, CONNACK, PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK, PINGREQ, PINGRESP, DISCONNECT and AUTH. Paste consecutive packets and Remaining Length splits them one by one.
Do I need a .pcap, TLS keys or an MQTT broker?
No. Paste raw MQTT wire bytes after removing TLS, WebSocket or other transport framing. The tool never connects to a broker, sends network requests or decrypts traffic. A PCAP container must be unpacked first to extract its MQTT bytes.
Why is my PUBLISH payload not formatted?
MQTT treats the payload as opaque bytes. Content Type and Payload Format Indicator do not make it JSON. Use the UTF-8 or hex preview here; if you know it is JSON, copy the text into JSON Formatter for the next step.
Does the $share prefix take part in topic matching?
No. In $share/{ShareName}/{filter}, ShareName identifies a server-side sharing group; only {filter} matches published topics. The tool checks that ShareName is non-empty and contains no /, + or #, and that No Local is not enabled on a shared subscription.
Does a clean decode prove the whole session is valid?
No. The tool checks each packet’s wire structure, flags, property context, reason code, UTF-8, topic filters and cross-property rules. It does not reconstruct full session state, packet ordering, cross-packet Topic Alias bindings or authorization. Click any diagnostic offset to locate its bytes.