I have listed a few free public and private MQTT brokers that you can use for testing or prototyping.

 

Private MQTT Broker: In a private broker, only devices that you set can publish and subscribe to the topics on the broker. You should use this for production & prototyping.

Public MQTT Broker: In a public broker, any device can publish and subscribe to topics on the broker. There is no privacy. Public brokers should never be used in production. If you simply want to learn or play around with MQTT then use this.

If you want to install your own broker on your computer or virtual machine see this:
Installing Mosquitto Broker ob Ubuntu/Windows/Debian

The information in the tables were last updated on April 7th 2020.

Public MQTT Brokers

NameBroker AddressTCP PortTLS PortWebSocket PortMessage RetentionPersistent SessionSign Up RequredLink
Eclipsemqtt.eclipse.org1883N/A80, 443YESYESNOLink
Mosquittotest.mosquitto.org18838883, 888480YESYESNOLink
HiveMQbroker.hivemq.com1883N/A8000YESYESNOLink
Flespimqtt.flespi.io1883888380, 443YESYESYESLink
Diotymqtt.dioty.co188388838080, 8880YESYESYESLink
Fluuxmqtt.fluux.io18838883N/AN/AN/ANOLink
EMQXbroker.emqx.io188388838083YESYESNOLink

Private MQTT Brokers

NameTCP PortTLS PortWebSocket PortMessage RetentionPersistent SessionQoS LevelsFree LimitsLink
AzureNO8883443NOLimited0, 18000 messages/dayLink
AWSNO8883443NOLimited0, 1250,000/monthLink
CloudMQTTCustom PortCustom PortCustom PortNOT SUREYES0, 1, 25 Connections & 10 Kbit/sLink

Also, see:
5 Best MQTT Clients For Testing