How to Install The Mosquitto MQTT Broker on Windows

install mosquitto icon In this tutorial you will learn how to install the mosquitto MQTT broker (server) on Windows.

See the installing Mosquitto on Linux tutorial for how to install on a local Linux server and also a cloud server (AWS).

Installing The Mosquitto Broker on Windows

Note: The term server instead of broker as been adopted as of MQTT version 3.1.1

There are two possibilities:

  • Quick Install
  • Standard Install

Quick Windows Install

The problem with the standard install is that there are certain dependencies that need to be installed before you do the mosquitto install.

This involves installing software and copying files from the install into the Mosquitto install folder.

However, if you have already installed Mosquitto on another windows machine e.g. XP and want to install it on another machine e.g. Windows 10 then you can just copy the directory containing the mosquitto files to the new machine.

I copied my windows XP install (32 bit) onto a windows 10 (64bit) machine and a Windows 7 machine and it worked OK.

I’ve create a zipped directory which I’ve used on Windows 10 and Windows 7.

You can download it here– Don’t forget to virus check it let me know if you have any problems with it.

Just unzip it go to the directory and run the broker manually as covered later.

Video – How to Install Mosquitto Broker on Windows

Standard Install On Windows

As mentioned earlier the big problem with the Windows Install is that there are lots of dependencies that you also need to install or have installed.

However the advantage is that you can install Mosquitto as a service which starts automatically. This is not important for a test environment.

First you will need to download the Windows install files from here.


I used the cygwin version (not sure of the exact differences ).

Essentially you will run the install twice.

The first time you run it it will warn you of dependencies.


However it creates the mosquitto directory and copies files to it.

You then need to copy the additional files to the directory before you run the install again. (full list below)

The the second time you run it it should create the service entry and proceed without errors.

There are good detailed step by step install instructions for windows here.

It is important that you install the addition files, and copy them to the mosquitto directory, if you don’t then when you try to start mosquitto you will get an error message complaining about a missing dll.


In the above case it was the cygcrypto-1.0.0.dll.

When you have installed Mosquitto and copied the additional files then this is what the mosquitto directory looks like when finished.


Note 1: above screenshot is missing some files from cygwin as it was installed and the files were in the right path.

Note 2: there is readme-windows.txt file in the mosquitto install directory that you should read

Here is a complete list of additional files that you need:


Starting Mosquitto on Windows

If you have installed Mosquitto using the install .exe and ticked the start as service box then the mosquitto broker starts as a service.

This is what you want in a production environment but for testing you will want to start it manually.

To stop the mosquitto server if it is running as a service. go to control panel>admin tools>services.


You can stop the broker and change the automatic startup settings so it doesn’t automatically start on Windows start up.

Note: On my install (on XP) it wouldn’t start as a service and gave error code 1053. This wasn’t a problem because I wanted to start it manually anyway.

To start the broker manually open a command prompt and go to the mosquitto install directory and type mosquitto.


You can also use various command line switches. Type

mosquitto -h

for help.


To start in verbose mode so that you can see console messages use the -v option:


Testing The Install

To test it is running use command:

  • netstat -a


You should see the Mosquitto broker running on port 1883 as shown in the screen shot above.

The Mosquitto.conf File

The configuration file (mosquitto.conf) that comes with the install is completely commented out, and the MQTT broker doesn’t need it.

However when Mosquitto runs as a service it uses this configuration file.

See Quick Guide to The Mosquitto.conf File With Examples

Mosquitto Logging

If you enable logging in the mosquitto.conf file then when Windows 10 runs as a service it creates this file with restricted permissions, and locks the file while the broker is running.

If you stop the broker you can change the permissions on the file to access it.

If you run the broker manually then again you will need to stop the broker before you can read the log file.

See Understanding and Configuring Logging on Mosquitto

Running Multiple Mosquitto Brokers

You can configure a broker to listen on several ports, but to create multiple brokers with their own configurations then you will need to start multiple instances of mosquitto. See Quick Guide to the Mosquitto.conf file and this video on running multiple brokers.


Start mosquitto and listen on port 1883

mosquitto -p 1883

Start mosquitto as a daemon and listen on port 1884

mosquitto -p 1884 -d

Start mosquitto as a daemon and use the mosquitti-2.conf file.

mosquitto -c c:\mosquitto\mosquitto-2.conf -d

Mosquitto Client Scripts

The windows install includes the client scripts.

There is a simple subscriber client


and a publisher client



mosquitto_sub –help

They are useful for some quick tests. See Using The Mosquitto_pub and Mosquitto_sub Client Tools- Examples


  • I didn’t get the scripts to work on Windows XP -Error not a vaild win32 application
  • On Windows 7 and 10 they gave an error regarding a missing msvcr100.dll file. I found the file on my system and copied it to the Mosquitto directory and they worked OK.

Other Tools

MQTTlensMQTTlens is also very useful for troubleshooting and quick testing. It is an add-on for the chrome browser.

It lets you publish and subscribe to topics using a web interface, and is much easier to use than the command line clients.

mqtt-ping-icon MQTT-Ping -Python Tool written by me that works like the traditional IP ping command tool.

Mosquitto Configuration Tutorials

Other Related Articles and Resources:



  1. when i type C:\>mosquitto>mosquito in the command prompt …it says access is denied can anyone pls help

  2. Hi,

    Try to run mosquitto broker and cliënt on raspberry pi3.
    Get always connection refuzen not authorised.
    Someting with the User? The netstat -t give a time_wait?

    Thks for your help,

  3. This guide was really usefull!

    First time playng with MTTQ, I of course chose to follow the “hard way” to install mosquitto on Windows 10 (- LOL -)…
    After some hours… I realized that the last Win32OpenSSL_Light version (v 1.1.0) doesn’t contein the two requested files (libeay32.dll ssleay32.dll), and I sorted out using the version 1.0.2n…

    Then I had the VCRUNTIME140.dll issue, and this was fixed installing ‘Microsoft Visual C++ 2015 Redistributable (x86)’ (32bit version), as discribed in others comments.

    And at last… I can turn on and off a led on my ESP-01 sending MTTC command (oops… “publishing”…) from my PC using mosquitto_pub…

  4. Hi Steve,

    Thank for taking the time and creating this Zip file.
    I was stuck with my mosquitto install (win 10 Pro / x64) and actually was at a point to consider running mosquitto in VM 🙂

  5. Hi Steve,
    I had almost given up installing mosquitto on windows until I found your tutorial. Success! The zip file was extremely helpful.

  6. Hi Steve
    in the installation process at the end I get an error called The program can’t start because VCRUNTIME140.dll is missing from your computer. Try reinstall the program to fix this problem

    1. Hi All,
      I had the VCRUNTIME140.dll issue when I install MQTT just now, and I search the issue at web, have a solution it’s Visual C++ Redistributable for Visual Studio 2015 installed, I just download the file and installed, and re-install mosquitto, the problem has been solved, hope the information can help you.

      1. Note that you need to install 32-bit version of it. I had 64-bit version (x64) but it is not compatible with this and the symptom was that I could not start mosquitto and the error message was ‘The application was unable to start correctly (0xc000007b)’
        After installing ‘Microsoft Visual C++ 2015 Redistributable (x86)’ it started.

  7. Hi steves
    I followed you and it works correctly.
    Butwhen I stopped mosquitto as below, publish and subscribe work again!!!why?
    code :
    pc@ubuntu:~$ sudo /etc/init.d/mosquitto stop
    [ ok ] Stopping mosquitto (via systemctl): mosquitto.service.

    pc@ubuntu:~$ mosquitto_pub -d -t /topic1 -m myMessage
    Client mosqpub/7237-ubuntu sending CONNECT
    Client mosqpub/7237-ubuntu received CONNACK
    Client mosqpub/7237-ubuntu sending PUBLISH (d0, q0, r0, m1, ‘/topic1’, … (2 bytes))
    Client mosqpub/7237-ubuntu sending DISCONNECT

    mosquitto_sub -d -t /topic1
    Client mosqsub/7104-ubuntu sending CONNECT
    Client mosqsub/7104-ubuntu received CONNACK
    Client mosqsub/7104-ubuntu sending SUBSCRIBE (Mid: 1, Topic: /topic1, QoS: 0)
    Client mosqsub/7104-ubuntu received SUBACK
    Subscribed (mid: 1): 0
    Client mosqsub/7104-ubuntu received PUBLISH (d0, q0, r0, m0, ‘/topic1’, … (2 bytes))


    1. It doesn’t look like it is being stopped or it may be automatically restarting. Ubuntu installs don’t use the init scripts.
      Try using the sudo service mosquitto stop command.
      You can check using netstat -at command

    2. Thx!
      I tried to install my web server(windows server 2016(64bit) and
      lots of error makes me crazy.
      I spent time almost 12h to catch errors.
      But this articls’s quick install method is only work on my server.

  8. hi,

    my subscriber is written in golang.
    and i try to install it in windows..
    now i need to install some of the mqtt package which is used in the golang program
    MQTT “”
    _ “”

    how do i do that ?? many thanks

Leave a Reply

Your email address will not be published. Required fields are marked *