Toolman

What port does MQTT use?

MQTT uses 1883 and 8883, and which one depends on what you are doing.

Plain and TLS, the same split as every other protocol that gained encryption later.

PortProtocolNameWhat it is for
1883TCPMQTTLightweight publish/subscribe messaging for IoT devices.
8883TCPMQTT over TLSEncrypted MQTT.

Exposing it

Unencrypted and often unauthenticated by default. Use port 8883 for MQTT over TLS.

Checking it is listening

sudo lsof -i :1883          # macOS, Linux
netstat -ano | findstr :1883   # Windows
nc -zv host 1883               # from elsewhere

An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.

Frequently asked questions

What port does MQTT use?

MQTT uses ports 1883, 8883, and they do different jobs. 1883: Lightweight publish/subscribe messaging for IoT devices. 8883: Encrypted MQTT.

Is port 1883 safe to expose to the internet?

Unencrypted and often unauthenticated by default. Use port 8883 for MQTT over TLS.

How do I check whether MQTT is listening?

sudo lsof -i :1883 on macOS or Linux, netstat -ano | findstr :1883 on Windows. From another machine, nc -zv host 1883 says whether anything answers.

Other services

Port 1883 in full · Port 8883 in full · Every service · All port numbers