Home / Localhost / localhost:5000

localhost:5000 (Flask): not working and fixes

Port 5000 is Flask’s default and clashes with AirPlay on macOS. How to open it and fix it.

Open this address: http://localhost:5000This opens on your own computer. It only works if the program is running.

localhost:5000 is the default address for Flask apps. On a Mac it often fails because AirPlay Receiver already uses port 5000.

localhost:5000 in a browser address bar reaches port 5000 on your computer, where Flask is running

What runs on localhost:5000

Commands to start and test port 5000

Flask
flask run
Flask on another port
flask run --port 5001
Plain Python Flask file
python app.py

Find what is using port 5000

Run these in a terminal on your computer. Nothing is sent to this site.

If localhost:5000 will not open

Address already in use on a Mac
macOS AirPlay Receiver is using port 5000. Turn it off in System Settings, General, AirDrop & Handoff, or run Flask on 5001.
Flask: command not found
Activate your virtual environment first, and check Flask is installed with pip show flask.
404 Not Found
The server runs but that URL has no route. Check the @app.route paths.
Flask is unreachable from Docker or another computer
By default Flask listens only on 127.0.0.1. Run flask run --host=0.0.0.0, and publish the port in Docker.
Changes do not show up
Turn on debug mode with flask run --debug so the server reloads when you save.

Other ports like 5000

PortUsually used by
localhost:3000React, Next.js, Express
localhost:5173Vite dev server
localhost:4200Angular dev server
localhost:8000Django, PHP, Python
localhost:8080Tomcat, Spring Boot, Docker
localhost:8888Jupyter Notebook
localhost:9000PHP-FPM, SonarQube

Questions about localhost:5000

Why is port 5000 in use on my Mac?
On macOS Monterey and newer, AirPlay Receiver listens on port 5000. Turn it off in System Settings or use another port.
How do I run Flask on a different port?
Run flask run --port 5001, or call app.run(port=5001) in your script.

Updated 2026-10-20

Free tools that help

Related pages