Port 5432: PostgreSQL
TCP 5432 is the port for PostgreSQL. Never on the internet; restrict pg_hba.conf and use private networking.
| Service | PostgreSQL |
|---|---|
| Protocol | TCP |
| Exposure risk | High: do not expose to the internet |
| Range | Registered (1024–49151) |
What port 5432 does
The default port for PostgreSQL. Connection poolers such as PgBouncer commonly use 6432.
Should port 5432 be open?
Never on the internet; restrict pg_hba.conf and use private networking.
Find what's listening on port 5432
- Linux:
sudo ss -tulpn | grep :5432 - macOS:
sudo lsof -nP -i :5432 - Windows:
netstat -ano | findstr :5432, then look up the PID in Task Manager.
Open or block it in a firewall
- ufw:
sudo ufw allow 5432/tcp(ordeny) - firewalld:
sudo firewall-cmd --add-port=5432/tcp --permanent && sudo firewall-cmd --reload - Windows:
New-NetFirewallRule -DisplayName "Port 5432" -Direction Inbound -Protocol TCP -LocalPort 5432 -Action Allow
Port assignment per the IANA Service Name and Transport Protocol Port Number Registry. Test several ports at once with the port scanner, or any port with the open port checker.
Questions about port 5432
What is port 5432 used for?
PostgreSQL. The default port for PostgreSQL. Connection poolers such as PgBouncer commonly use 6432.
Is port 5432 TCP or UDP?
TCP. PostgreSQL uses TCP port 5432.
Is it safe to open port 5432?
High: do not expose to the internet. Never on the internet; restrict pg_hba.conf and use private networking.
How do I check if port 5432 is open?
Use the checker on this page: it connects to your host on TCP 5432 from the internet. Locally, run
nc -vz host 5432 (macOS/Linux) or Test-NetConnection host -Port 5432 (PowerShell). To see what is listening on your own machine, run ss -tulpn | grep :5432 (Linux) or netstat -ano | findstr :5432 (Windows).