How to access my online Postgres DB on my local machine in pgAdmin4?

I am able to run command line queries and statements on my online database but not able to create a server instance on my local machine through pgAdmin4 My local PG admin is running on windows 8 with 9.6 and 10 version of postgresql. My online server is running on ubuntu with postgres (not sure of which version). It keeps sending this error Unable to connect to server:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host “xxxxxxxxxxx” and accepting TCP/IP connections on port 5432?