MQTT wildcard tester

Type a subscription pattern and a list of sample topics. Each topic is checked as you type, with the matched levels highlighted.

Results

sensors/livingroom/temperature

sensors/kitchen/temperature

sensors/kitchen/humidity

Level 3 ("humidity") does not equal "temperature".

sensors/livingroom/temperature/raw

The topic has more levels than the pattern.

$SYS/broker/uptime

Level 1 ("$SYS") does not equal "sensors".

MQTT wildcards in one table

Wildcard Matches Example
+Exactly one level, including an empty onehome/+/temp matches home/kitchen/temp
#Zero or more remaining levels, last character onlyhome/# matches home and home/kitchen/temp
$SYS/#Broker metrics, which # alone never matches$SYS/broker/uptime

What + matches

The single-level wildcard + matches exactly one topic level, including an empty one. a//b is a legal topic with an empty middle level, and a/+/b matches it.

What # matches

The multi-level wildcard # matches zero or more remaining levels and must be the last character of the pattern. Because it can match zero levels, sport/# also matches sport itself.

Wildcards and $ topics

A pattern starting with + or # never matches a topic starting with $, such as $SYS/.... Subscribe to $SYS/# directly to see them. The $SYS topics reference lists what each broker publishes there.

Where wildcards are allowed

Only in subscriptions. A topic you publish to must be fully specified, with no + or # in it.

Frequently asked questions

What does + match in MQTT?

The + wildcard matches exactly one topic level, including an empty level. sensors/+/temperature matches sensors/kitchen/temperature but not sensors/kitchen/east/temperature.

Does # match the parent topic too?

The # wildcard matches zero or more remaining levels, so sport/# matches sport itself as well as sport/tennis and anything deeper.

How do you subscribe to all topics in MQTT?

Subscribe to #. It matches every topic on the broker except those starting with $, so add a second subscription to $SYS/# to see the broker's own metrics.

Why does # not match $SYS topics?

A pattern starting with + or # never matches a topic starting with $. That keeps broker internals such as $SYS out of a blanket subscription. Subscribe to $SYS/# explicitly to see them.

MQTT Viewer's topic tree subscribes with the same rules and shows every matching topic live. Download MQTT Viewer.

MQTT Viewer is free and open source, and runs on macOS, Windows and Linux.

Download MQTT Viewer