HomeMQTT Encode/Decode

MQTT Encode/Decode

Online MQTT encode and decode tool for CONNECT, PUBLISH, SUBSCRIBE packet building and hex parsing, suitable for protocol learning and IoT integration debugging.

Paste MQTT packet data captured from Wireshark, logs, or network analyzers.

Example Packets

Decoded Result

Enter packet data and the parser runs automatically

MQTT Protocol Guide

Understanding MQTT

MQTT is a lightweight publish-subscribe protocol for IoT scenarios with low bandwidth and unstable networks. This tool helps you build and parse control packets for protocol learning and integration debugging.

Packet Structure Essentials

  • Each MQTT packet contains fixed header, variable header, and payload. The fixed header is at least 2 bytes.
  • In the first fixed-header byte, high 4 bits are packet type and low 4 bits are type-specific flags.
  • Remaining Length uses variable-length encoding up to 4 bytes and supports values up to 268435455.
  • PUBLISH packets must include Packet Identifier when QoS is greater than 0.

MQTT Packet Type Reference

CodeNameDirectionDescription
0x10CONNECTC->SClient connection request
0x20CONNACKS->CConnection acknowledgment
0x30PUBLISHC<->SPublish message
0x40PUBACKC<->SPublish acknowledgment (QoS 1)
0x50PUBRECC<->SPublish received (QoS 2)
0x60PUBRELC<->SPublish release (QoS 2)
0x70PUBCOMPC<->SPublish complete (QoS 2)
0x80SUBSCRIBEC->SSubscribe request
0x90SUBACKS->CSubscribe acknowledgment
0xA0UNSUBSCRIBEC->SUnsubscribe request
0xB0UNSUBACKS->CUnsubscribe acknowledgment
0xC0PINGREQC->SHeartbeat request
0xD0PINGRESPS->CHeartbeat response
0xE0DISCONNECTC->SDisconnect

QoS Semantics

  • QoS 0: at most once, lowest overhead, packet loss is possible.
  • QoS 1: at least once, delivery guaranteed but duplicates may occur.
  • QoS 2: exactly once, highest reliability with the highest handshake cost.

Typical Use Cases

  • Parse captured hex packets and inspect control type and field values quickly.
  • Generate CONNECT, PUBLISH, and SUBSCRIBE packets for broker and device integration tests.
  • Teach MQTT binary structure with practical examples of fixed header and remaining length.
  • Troubleshoot protocol-level issues such as connection failure, subscribe mismatch, and delivery anomalies.

Data is processed locally in your browser by default and will not be uploaded to any server. Upload will be clearly indicated if required.

© 2026 See-Tool. All rights reserved. | Contact Us