MQTT Reason Codes Reference

MQTT 5.0 reason codes for CONNECT, PUBLISH, SUBSCRIBE and DISCONNECT.

Searchable MQTT 5.0 reason code reference. Look up any single-byte code by hex value or name, see which CONNACK, PUBACK, SUBACK or DISCONNECT packets use it, and read the meaning.

How do MQTT 5.0 reason codes work?

A reason code is a single byte returned in acknowledgement packets (CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK) and in DISCONNECT and AUTH. Values from 0x00 to 0x7F indicate success or normal operation, while values from 0x80 to 0xFF indicate an error. The same byte can appear in several packet types.

The MQTT Reason Codes Reference is a searchable lookup for the single-byte reason codes introduced in MQTT 5.0. Unlike MQTT 3.1.1, which had a tiny set of CONNACK return codes, version 5.0 uses a unified reason-code byte across nearly every acknowledgement and the DISCONNECT and AUTH packets — so the same 0x87 can explain a refused connect, a blocked publish, or a denied subscribe.

How it works

Every MQTT 5.0 control packet that reports a result carries a one-byte reason code. The high bit splits the range cleanly:

0x00 - 0x7F   Success / normal operation
0x80 - 0xFF   Error / failure

Acknowledgement packets — CONNACK, PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK — plus DISCONNECT and AUTH each return one. The label attached to a value can vary by packet: 0x00 is Success in CONNACK, Granted QoS 0 in SUBACK, and Normal disconnection in DISCONNECT. This tool keeps the full table in your browser and filters it by hex value, decimal value, name, packet type or description.

Example and tips

A clean session looks like CONNECTCONNACK 0x00 SuccessSUBSCRIBESUBACK 0x01 Granted QoS 1PUBLISHPUBACK 0x00 Success. Watch the success-range informational codes: 0x10 (no matching subscribers) and 0x11 (no subscription existed) are not errors, so don’t alert on them. On the error side, a server can now send a DISCONNECT to the client with a reason such as 0x8D (Keep Alive timeout), 0x8E (Session taken over) or 0x95 (Packet too large) — read that byte to learn why the broker dropped you rather than guessing.