# MQTT Client

Enter the URL of an MQTT-over-WebSocket broker (ws:// or wss://) and press Connect: your browser connects straight to the broker and you can subscribe and publish. This site’s server relays nothing. A browser cannot reach plain TCP (port 1883).

- URL: https://tools.itlibra.com/en/mqtt-client
- On-device・Network lookup
- Last updated: 2026-11-23

## How to use

1. Enter the broker’s WebSocket URL (e.g. wss://broker.example.com:8084/mqtt). Set the MQTT version (v3.1.1 or v5), client ID, user name and password as needed.
2. Press Connect (Ctrl/⌘+Enter also works). Wait until the status says Connected. If it fails, read the code of the answer in the log and “If it does not connect”.
3. Under Subscribe, enter a topic filter (the + and # wildcards work) and a QoS. Messages that arrive are listed in the log on the right with their topic, QoS and retain flag.
4. Under Publish, enter the topic, QoS, retain and payload (text, hex or Base64). With v5 you can add Content Type, Response Topic, an expiry and user properties.
5. Search the log, read JSON formatted or binary as hex, and save it as JSON Lines or text. Messages you publish often can be saved as templates.

## Use cases

- Check that a broker under development works, by subscribing and publishing
- See which topics a wildcard subscription (sensors/+/temperature, sensors/#) matches
- Check how QoS 0, 1 and 2 and retain behave (does a stored message arrive right after subscribing?)
- Compare why a connection is refused (authentication, client ID) in v3.1.1 and v5
- Narrow down why a browser cannot connect to MQTT (WebSocket port, Origin, certificate)

## What it does

### Connects straight from your browser to the broker

Connecting, subscribing and publishing happen only between your browser and the broker. This site’s server neither relays nor stores the traffic. Opening the page does not connect; only pressing Connect does. No public test broker is built in.

### Explains why plain TCP is out

A browser cannot open a TCP socket, so mqtt:// and port 1883 are not reachable. Use the ws:// or wss:// port on which the broker has MQTT over WebSocket enabled. If you enter mqtt://, the tool says so.

### v3.1.1 and v5, with topic checks

Connect with v3.1.1 or v5. Before sending, it checks where + and # are placed in a topic filter, wildcards in a topic to publish to, and shared subscriptions ($share/…, v5 only) against the MQTT rules. A received message shows which subscription filters matched.

### QoS, retain and v5 properties

Set QoS 0, 1 or 2 for subscribing and publishing, retain, and for v5 the Content Type, Response Topic, message expiry, Payload Format Indicator and user properties. The QoS the broker granted is logged.

### Search, format and save the log

Up to 2,000 messages and about 50 MB in total are logged. Filter by topic or text, read JSON formatted and binary as hex, and save as JSON Lines or text.


## Supported formats

### Payload

- Text (UTF-8)
- Hex (e.g. de ad be ef)
- Base64 (standard or URL-safe)


## Capability matrix

| Feature | Support | Notes |
| --- | --- | --- |
| Connect over MQTT over WebSocket (ws://, wss://) with v3.1.1 or v5 | Supported | — |
| User name, password, client ID, clean start and keep alive | Supported | — |
| Subscribe (+ and # wildcards, QoS 0–2) and unsubscribe | Supported | — |
| Publish (QoS 0–2, retain, text/hex/Base64, the main v5 properties) | Supported | — |
| Save what you publish as templates and publish it again | Supported | Stored only inside this browser |
| Automatic reconnect after a drop | Partial | Off by default. When on, it has a limit of 1 to 10 attempts and subscribes again |
| Plain TCP (mqtt://, port 1883) | Not supported | A browser cannot open a TCP socket. Use the WebSocket port |
| Will message, TLS client certificates, v5 enhanced authentication | Not supported | — |
| Connecting to brokers your browser cannot reach | Not supported | This site’s server does not relay |

## Limits & notes

- One message is cut at 1 MB (1,048,576 characters of text or 1,048,576 bytes of binary); anything beyond is not logged. Publishing is limited to 1 MB as well. With v5, the connect tells the broker to send packets of at most 2 MB (v3.1.1 has no such mechanism).
- The log keeps the newest 2,000 messages and about 50 MB in total, dropping the oldest first. The list shows the newest 300.
- Subscribing, unsubscribing and publishing together are limited to 20 per second.
- The answer to the connect is waited for 15 seconds.
- A client ID can be up to 256 characters. Some brokers accept only up to 23 letters and digits (the MQTT v3.1.1 rule is that a broker must accept those).
- Only the URL (without query and user info), the version, the client ID, the subscribe and publish settings and the templates are saved. The user name and password are not.
- How QoS and retain are handled differs between broker implementations. The granted QoS is shown in the log.

## Privacy & safety

The only server contacted is the broker at the URL you enter. Traffic goes straight from your browser to it; this site’s server neither relays nor stores it. The password is not saved and not written to the log. Topics on a public broker can be read by anyone, so do not publish secrets. The log disappears when you close the page.

## FAQ

### Can a browser connect to an MQTT broker on port 1883?

No. A browser cannot open a TCP socket, so mqtt:// and 1883 are out. Enable MQTT over WebSocket in the broker and use that ws:// or wss:// port (for example 8083, 8084 or 9001, depending on the setup).

### Why is my connection refused?

The code of the connect answer tells. In v3.1.1, 4 is a wrong user name or password, 5 is not authorized and 2 is a rejected client ID. In v5, 0x86 is bad credentials, 0x87 is not authorized and 0x85 is a rejected client ID. The tool writes the meaning of the code into the log.

### What is the difference between QoS 0, 1 and 2?

QoS 0 is at most once (may be lost), QoS 1 is at least once (may repeat) and QoS 2 is exactly once. The QoS actually used is the lower of the publish QoS and the subscription QoS.

### What is retain?

When you publish with retain, the broker keeps the last message of that topic and delivers it right away to anyone who subscribes later. The tool marks stored messages with “retain” in the log.

### What is the difference between the + and # wildcards?

\+ matches one level; # matches all the remaining levels and may only be last. sensors/+/temperature matches sensors/room1/temperature, and sensors/# matches everything under sensors. A topic starting with $ (such as $SYS) is not matched by a filter that starts with + or #.

### How is this different from the WebSocket and Socket.IO clients?

This tool speaks the MQTT protocol (subscribe, publish, QoS). For raw WebSocket messages use the WebSocket client; for Socket.IO events use the Socket.IO client.
