1. DevMirror
  2. Any server

How to open localhost on your phone

Your site runs fine at localhost:3000 on your computer, but your phone can't open it. Here's why, and four ways to test your local site on a real Android phone or iPhone.

Quick answer

localhost on your phone means the phone itself. To open a site running on your computer:

  1. Start your dev server so it listens on the network (0.0.0.0 or --host).
  2. Find your computer's local IP address, such as 192.168.1.14.
  3. Put your phone on the same Wi-Fi.
  4. Open http://YOUR-IP:PORT in your phone's browser.

Why localhost doesn't work on your phone

localhost and 127.0.0.1 are loopback addresses: they always mean "this device". On your computer they point at your computer. On your phone they point at the phone, which isn't running your dev server, so you get "This site can't be reached".

There's a second catch. Many dev servers only listen on 127.0.0.1 by default, so even with the right IP they refuse connections from other devices. You need to fix both.

Step 1: Make your dev server listen on the network

Binding to 0.0.0.0 tells the server to accept connections on every network interface, including your Wi-Fi. Here's the flag for common tools:

ToolCommand
Vite, SvelteKit, Astronpm run dev -- --host
Next.jsnpm run dev -- -H 0.0.0.0 (often already on)
Angularng serve --host 0.0.0.0
VS Code Live ServerUsually works as-is on port 5500
Djangopython manage.py runserver 0.0.0.0:8000
Flaskflask run --host=0.0.0.0
FastAPI (Uvicorn)uvicorn main:app --host 0.0.0.0
Railsrails s -b 0.0.0.0
PHP built-in serverphp -S 0.0.0.0:8000
Python static filespython -m http.server 8000 (all interfaces by default)
Express / Nodeapp.listen(3000) listens everywhere, unless you passed 'localhost' as the host

Only do this on networks you trust. Anyone on the same Wi-Fi can reach your dev server while it's bound to 0.0.0.0.

Step 2: Find your computer's local IP address

ComputerRun thisLook for
WindowsipconfigIPv4 Address under Wireless LAN adapter Wi-Fi (or Ethernet if you're wired)
macOSipconfig getifaddr en0Prints the address directly (en0 is usually Wi-Fi)
Linuxhostname -IThe first address in the list

Your local IP almost always starts with 192.168., 10. or 172.16–172.31. Ignore addresses belonging to vEthernet (WSL/Hyper-V), Docker or VPN adapters. Your phone can't reach those.

Many dev servers print it for you. Vite and Next.js show a Network: line with the full URL.

Step 3: Open it on your phone

Connect your phone to the same Wi-Fi and type the address into its browser:

http://192.168.1.14:3000

Use http://, not https://, unless you've set up HTTPS locally. Your router may give your computer a new IP later, so if a bookmark stops working, check the IP again.

Skip the IP hunt

DevMirror finds servers on common dev ports on your Wi-Fi and opens it on your Android phone in one tap.

Get DevMirror

Four ways to see localhost on a phone

MethodPhonesNeedsBest for
DevMirrorAndroidSame Wi-FiEveryday testing without typing IPs
Manual IPAndroid, iPhoneSame Wi-FiOne-off checks, iPhone
USB (adb reverse)AndroidCable + USB debuggingLocked-down or isolated networks
Tunnel (ngrok, Cloudflare Tunnel, VS Code port forwarding)AnyInternet, often an accountTesting from another network or sharing with someone. Slower, and the URL is public

Troubleshooting

"This site can't be reached" or it times out

Work through these in order: the server is bound to 0.0.0.0 (step 1), you're using the Wi-Fi adapter's IP (step 2), and the firewall allows the port. On Windows, allow your dev server's program (usually Node.js, Python or Visual Studio Code) on Private networks under Windows Security → Firewall & network protection → Allow an app through firewall.

Your phone and computer aren't really on the same network

Guest networks, public Wi-Fi and many office networks use client isolation, which stops devices from talking to each other. Some routers also separate their 2.4 GHz and 5 GHz networks. If you can't change the network, turn on your phone's hotspot and connect your computer to it. That works every time. A VPN on your computer can also block local traffic, so pause it while testing.

The page loads but API calls fail

If your frontend calls http://localhost:4000/api, the phone sends that request to itself. Use relative URLs (/api) with a dev proxy, or point the API URL at your computer's IP. The same goes for auth callback URLs set to localhost.

Django says "Invalid HTTP_HOST header"

Add your computer's IP to ALLOWED_HOSTS in settings.py, or use ['*'] during local development only.

Wi-Fi won't cooperate? Use USB (Android)

With USB debugging enabled and Android platform-tools installed, forward the port over the cable:

adb reverse tcp:3000 tcp:3000

Now http://localhost:3000 on the phone reaches your computer. In DevMirror, enter 127.0.0.1 and port 3000. No Wi-Fi involved.

Bonus: inspect the page on your phone with DevTools

Android: enable USB debugging, plug in, and open chrome://inspect in Chrome on your computer. You get full DevTools for the page open on your phone.

iPhone: turn on Settings → Safari → Advanced → Web Inspector, connect to a Mac, and use Safari's Develop menu.