Toolman

What port does PostgreSQL use?

PostgreSQL uses port 5432 over TCP.

PortProtocolNameWhat it is for
5432TCPPostgreSQLThe default PostgreSQL port.

Exposing it

Keep it on a private network. Configure `pg_hba.conf` deliberately — a permissive `host all all 0.0.0.0/0 md5` line is a common and serious mistake.

Checking it is listening

sudo lsof -i :5432          # macOS, Linux
netstat -ano | findstr :5432   # Windows
nc -zv host 5432               # from elsewhere

An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.

Frequently asked questions

What port does PostgreSQL use?

PostgreSQL uses port 5432 over TCP. The default PostgreSQL port.

Is port 5432 safe to expose to the internet?

Keep it on a private network. Configure `pg_hba.conf` deliberately — a permissive `host all all 0.0.0.0/0 md5` line is a common and serious mistake.

How do I check whether PostgreSQL is listening?

sudo lsof -i :5432 on macOS or Linux, netstat -ano | findstr :5432 on Windows. From another machine, nc -zv host 5432 says whether anything answers.

Other services

Port 5432 in full · Every service · All port numbers