How to Expose Localhost to the Internet
Prerequisites
- Node.js 22.14 or later
- A local app running on a common dev port (e.g. Vite on 5173, Next.js on 3000)
Start a tunnel
From your project directory:
npx localtolink
Example output:
LocalToLink v1.0.1
Detected local app:
http://localhost:5173
Connecting…
Public URL:
https://k7m2x9p4q1.localtolink.com
Expires:
2026-09-05 20:00 UTC (2 hours)
Tunnel active — press Ctrl+C to stop
Share the Public URL with anyone on the internet. Traffic is forwarded to your localhost over HTTPS automatically.
Specify a port
If auto-detection picks the wrong app:
npx localtolink --port 3000
LocalToLink scans these ports by default: 3000, 3001, 4000, 4200, 5000, 5173, 5174, 8000, 8080, 8888, 9000.
JSON output for scripts
npx localtolink --json
Returns a single JSON object on stdout with url, localPort, and expiresAt.
Free tier limits
| Limit | Value | |-------|-------| | Session duration | 2 hours | | Bandwidth | 1 GB per session | | Request rate | 10 requests/second | | Concurrent tunnels | 1 per IP | | Subdomain | Random 10-character (no custom subdomains in v1.0) |
Reconnection
If your network drops, LocalToLink reconnects automatically and keeps the same URL for up to 10 minutes after disconnect. After the grace window expires, you get a new random subdomain on the next session.
Visitor interstitial
Browser visitors see a one-time warning page before reaching your app. API clients and webhooks are not affected — they receive responses directly. To bypass the interstitial programmatically, send the header:
localtolink-skip-browser-warning: 1
What LocalToLink does not include (v1.0)
- Custom subdomains (planned for v1.5 Pro)
- Request inspector or replay (unlike ngrok)
- User accounts or persistent URLs across sessions
For webhook testing, see Test Webhooks Locally. For mobile testing with QR codes, see Test Localhost on Your Phone.
Try it now
Start a tunnel from your project directory — no account required.
$ npx localtolink