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 Jan 31st 2019.

Public MQTT Brokers

NameBroker AddressRegular/TCP PortSSL/TLS PORTWeb Socket PortRetain MessagesPersistent SessionSign Up RequredLink
Eclipseiot.eclipse.org1883N/A80, 443YESYESNOhttp://iot.eclipse.org/sandbox.html
Mosquittotest.mosquitto.org18838883, 888480YESYESNOhttp://test.mosquitto.org/
Flespimqtt.flespi.io1883888380, 443YESYESYEShttps://flespi.com/mqtt-broker
Diotymqtt.dioty.co188388838080, 8880YESYESYEShttp://www.dioty.co/

Private MQTT Brokers

Broker NameURLRegular/TCP PortSSL/TLS PORTWeb Socket PortRetain MessagesPersistent SessionQoS LevelsFree Limits
Azurehttps://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-supportN/A8883443NOYES0, 18000 messages/day
AWShttps://docs.aws.amazon.com/iot/latest/developerguide/mqtt.htmlN/A8883443NOYES0, 1250,000/month
CloudMQTThttps://www.cloudmqtt.com/plans.htmlCustom PortCustom PortCustom PortNOT SUREYES0, 1, 25 Connections & 10 Kbit/s