Skip to content
All posts
4 min read

How to Expose Localhost to the Internet (The Simple Way)

A beginner-friendly guide to making your local web app accessible from anywhere. No deployment, no cloud servers, no devops knowledge required.

tutorialbeginners

You built something on your computer. Maybe a website, an API, or a prototype. It works at localhost:3000. Now you want someone else to see it — a friend, a client, your team. But "localhost" only works on your machine.

Here's how to give it a public URL in about 60 seconds.

What "localhost" means

When you run a web app locally, it listens on a "port" — like localhost:3000. The word "localhost" is your computer talking to itself. Nobody else on the internet can reach it because your router and firewall block all incoming connections by default.

The fix: a tunnel

A tunnel creates a path from the public internet to your computer. When someone visits a URL like https://abc123.tunnel.localport.dev, the traffic goes through Localport's servers and arrives at your localhost:3000.

You don't deploy anything. You don't change any settings. You run one command.

Step by step

1. Install Localport

curl -fsSL https://get.localport.dev | sh

This takes about 10 seconds. It downloads a single binary file — no runtime, no dependencies.

2. Get a token

Sign up at dashboard.localport.io (free, no credit card). Create a tunnel and copy the token.

3. Start the tunnel

localport tunnel --token YOUR_TOKEN --local localhost:3000

Replace 3000 with whatever port your app runs on.

4. Share the URL

You'll see a URL like https://abc123.tunnel.localport.dev. Open it in your browser — you see your local app. Send the URL to anyone and they see it too.

5. Stop when done

Press Ctrl+C. The URL stops working immediately. No cleanup needed.

When you need this

  • Showing work to a client without deploying to a staging server
  • Testing webhooks from Stripe, GitHub, or Slack that need a real HTTPS URL
  • Testing on your phone by opening the URL on a different device
  • Sharing with teammates who want to see your changes before they're merged
  • Building with AI tools that need a callback URL to reach your local server

How is this different from deploying?

DeployingTunneling
Time to shareMinutes to hoursSeconds
Reflects local changesAfter redeployInstantly (it's your live local server)
Needs a serverYesNo
Costs moneyUsuallyFree tier available
Works when your computer is offYesNo

Tunneling is for development and sharing. Deploying is for production.

Is it secure?

Yes. The tunnel URL uses HTTPS with a valid TLS certificate. Only people who have the URL can access it — the subdomain is random and not discoverable. When you stop the tunnel, access stops immediately.

FAQ

Will it slow down my app? Barely. Localport adds a few milliseconds of latency. For development and demos, you won't notice. Does my computer need to stay on? Yes. The tunnel is active as long as the CLI is running. Close your terminal or shut down your computer, and the tunnel closes. Can I use a custom URL? On the Pro plan, you can reserve a subdomain so your URL stays the same between sessions. Try it free →