DEV Community

Cover image for How to access localhost from the Internet?

Posted on • Updated on

How to access localhost from the Internet?

Suppose you are working on a hobby project or building projects locally for learning few concepts. Once, you complete the project, and it works as expected, you might feel excited about sharing it with your friends and colleagues.

However, you don’t want to get into the pain of hosting it on a web server as it involves buying a domain name, hosting space, and various other configurations.

Now, some of you might suggest that use the port forwarding option. For those who are unaware of port forwarding, it is a process of intercepting data traffic headed for a computer’s IP/port combination and redirecting it to a different IP and/or port.

I am sure you want to access your localhost from the internet without the hassle of port forwarding & hosting your application on a web server. Don’t you?

Access localhost from the Internet

You can access localhost from the internet using a couple of services for free. Some of them that we are going to talk about in this blog post are:


We can use either of them to achieve our end goal. I have used ngrok and find it easy to set up and use. Actually, there is nothing as such to set it up.

If you’re a Windows user, you just need to download the binaries from and run it.

ngrok (pronounced as “en-grok“) gives you a public URL for the web app running on localhost.

It is a reverse proxy software that establishes secure connections from a public endpoint to a locally running service.

There are two ways to use ngrok:

  • Download the software from the official website
  • Use npm to install

Visit the official docs for more information.

Steps to download & use:

  1. Visit
  2. Download ngrok
  3. Extract the zip files and double click ngrok.exe

Once, you set up ngrok and execute it, there will be a command prompt as shown below:

Alt Text

Localtunnel will assign you a unique publicly accessible URL that will proxy all requests to your locally running webserver.

In order to use localtunnel you need nodejs installed on your machine.

To install localtunnel globally:

npm install -g localtunnel
Enter fullscreen mode Exit fullscreen mode

To start the webserver on port 80:

lt --port 8000
Enter fullscreen mode Exit fullscreen mode

To use port 3000:

lt --port 3000
Enter fullscreen mode Exit fullscreen mode is a client-less tool to instantly make a locally running application available on an internet-accessible URL. It doesn’t require us to install anything on our machine.

Simply, you can go to command prompt and execute the command given below:

ssh -R 80:localhost:8080
Enter fullscreen mode Exit fullscreen mode

Note: To open a command prompt, you can press Windows + R keys (⊞ Win + R), then type “cmd” and click on Enter.

If your application is running on local port 3000, then use this command:

ssh -R 80:localhost:3000
Enter fullscreen mode Exit fullscreen mode

Alt Text

With the help of these three services, you can access localhost from the internet. You may figure out the one that works best for you and enjoy sharing your publicly accessible URL among your friends.

This is my localhost reactjs app that is now exposed over the internet using ngrok service.

Alt Text

Closing Notes

This is a great utility for all the devs out there. Now, whatever web apps you build on your local system can be shared across with such ease.

Now, you know to access localhost from the internet, please share it with your friends and colleagues to educate them as well.

You may check our post on 👉 Getting started with Deno

Please visit our YouTube channel 👉 DotNetCrunch

Happy Learning!

Top comments (16)

phyberapex profile image

To be honest this seems like a hassle. For this use case I would just put it on Netlify tbh. If you use the CLI that's just on command.


gilesc9 profile image

That's a fair thing to do if you're building a frontend application. Though this posts example is purely just to show off something running from localhost. I've used ngrok in the past to test webhook implementations sent from third parties. For example, I needed to capture a webhook fired from DocuSign and debug it (in dotnet) but DocuSign doesn't know anything about my localhost. Deploying to a server doesn't help either because then I can't step through my code! Scenarios like this is where things like ngrok really shine. But if you're just wanting to show off work, agreed may as well just deploy somewhere and have a bit more guarantee it'll always be accessible.

andrewbaisden profile image
Andrew Baisden

Agreed its nice to have those kind of options however I would likely use Netlify or Vercel.

dotnetcrunchh profile image

But using doesn't seems to be hassle. Its just one command?

cshawaus profile image
Chris Shaw

I prefer full control over things, my solution is OpenVPN and Pi-hole which allows me to work both locally and remotely.

In addition, I've mapped a domain via CloudFlare to my home network that I can use for API testing when needed and no one ever gets to see my requests except myself.

The best part, if you've got the hardware, it's free and easy to build upon.

ghoshbishakh profile image
Bishakh Ghosh is a much simpler solution with more features. No need to download anything: Just run a command:

ssh -p 443 -R0:localhost:8000

Replace 8000 with your port.

pinggy tunnels to localhost

aprogrammer22 profile image

Hi DontNetCrunch,

I would like to add one more Free tool to expose local host to the internet. That is

TSOCKET: Create multiple TCP and HTTP tunnels and get public URLs.

tunnel ssh or rdp or vnc and connect remotely.

Completely free for personal and commercial use. There is no paid plan and there never will be a paid plain.

I hope you find it useful

bozicb profile image
Bojan Božić

Maybe useful to mention that the tunnel collapses when your internet goes down or just so after a while. The problem then is that you will get a new URL, so if you're sharing with someone you'll have to let them know and constantly check if your tunnel is still up. I've tried all three with students to have them hack a web server I'm running on my raspberry pi, but it's bothersome if you have it up for a while and need to notify every time you rebuild your tunnel.

kamalhossain profile image
Kamal Hossain

It will be nice if you add pricing for each services above.

dotnetcrunchh profile image

ngrok is free to use for limited features. However, the pricing can be referred from their official website. I have already shared the URL. Others are free.

moopet profile image
Ben Sinclair

They're all free unless you want to do "advanced" things with them.

burakisleyicii profile image
Burak İşleyici • Edited

Now you can use

kamalhossain profile image
Kamal Hossain


ilonahryunova profile image

By my opinion the straight forward method use service. This will allow you to connect to your server from anywhere. Static Public IP and Domain name for any device in any network. More than tunnel tool. UDP also working.

ahmythdev profile image
Ahmed ⚡

I built LocalXpose ( - a reverse proxy alternative to ngrok, I invite you guys to test it out.