Test Localhost on Your Phone
Why you need a tunnel for phone testing
Your phone cannot reach localhost on your laptop — they are different devices on different networks. A tunnel gives your phone a public HTTPS URL that forwards to your dev server.
Quick workflow
npx localtolink --port 5173
LocalToLink prints:
- A public URL like
https://k7m2x9p4q1.localtolink.com - A QR code in the terminal
Scan the QR code with your phone camera to open the URL instantly.
Disable QR code
For CI or headless environments:
npx localtolink --port 5173 --no-qr
The public URL is still printed — share it manually or via messaging.
Browser interstitial
The first time you open the tunnel URL in a mobile browser, you see LocalToLink's visitor warning page. Tap through once — a cookie bypasses it for 24 hours on that subdomain.
Testing tips
- Ensure your dev server binds to
0.0.0.0orlocalhost— most frameworks do by default - For responsive design, test portrait and landscape
- For API calls from mobile, your app must use relative URLs or the tunnel URL — not
localhost - WebSocket works through the tunnel (useful for Vite HMR — see Vite HMR guide)
Session limits
- 2 hours per session — restart if needed
- 1 GB bandwidth — sufficient for UI testing
- New session = new random subdomain (update bookmarks)
Framework-specific notes
- Vite: may need HMR config for hot reload over tunnel — see Vite HMR Through a Tunnel
- Next.js: see Next.js Dev Server Through a Tunnel
Try it now
Start a tunnel from your project directory — no account required.
$ npx localtolink