CoderTools

MQTT Topic Tester

Validate MQTT subscription patterns and test topic matching

Use + for single-level wildcard, # for multi-level wildcard

Enter one topic per line to test against the pattern

Quick Examples

Results

Enter a pattern and topics to test

Matched
Not Matched

Wildcard Reference

+ Single-Level Wildcard

Matches exactly one topic level at its position.

sensor/+/temp ✓ sensor/room1/temp
sensor/+/temp ✗ sensor/room1/sub/temp

# Multi-Level Wildcard

Matches any number of levels. Must be the last character in the pattern.

sensor/# ✓ sensor/a/b/c
home/+/# ✓ home/room/temp/value

MQTT Topic Patterns Guide

What is MQTT Topic?

MQTT topics are UTF-8 strings used to filter messages. They are hierarchical, with levels separated by forward slashes (/). Topics are case-sensitive and can include almost any character.

Topic Structure

A typical MQTT topic follows a hierarchical structure like 'building/floor/room/sensor/type'. This allows for flexible subscription patterns using wildcards.

Best Practices

  • Use meaningful, descriptive topic names that reflect the data hierarchy
  • Avoid leading slashes as they create an empty first level
  • Keep topic names reasonably short to reduce bandwidth usage
  • Use lowercase letters and hyphens for consistent naming

Frequently Asked Questions

What is the difference between + and # wildcards?

The + wildcard matches exactly one topic level (e.g., 'sensor/+/temp' matches 'sensor/kitchen/temp'), while # matches any number of levels and must be the last character (e.g., 'home/#' matches 'home', 'home/living', 'home/living/light').

Can I use wildcards when publishing messages?

No, wildcards (+ and #) can only be used in subscription topic filters. When publishing a message, you must specify the exact topic name without any wildcards.

Are MQTT topics case-sensitive?

Yes, MQTT topics are case-sensitive. 'Home/Temperature' and 'home/temperature' are treated as completely different topics. Always maintain consistent casing in your topic naming conventions.

Quick Menu

No recent tools