Guide

Open localhost on your phone: URL builder

Your app opens on the Mac, but the same localhost address fails on your phone. Build the address for the Mac on your local network, then check that the server accepts connections from another device.

By Anmol Sethi · Updated

In short

On a phone, localhost points to the phone itself. Use your Mac’s private network address and the server’s actual port, such as http://192.168.1.20:5173/. The builder below prepares that address. It does not test whether the server is listening or reachable.

Ask AIChatGPTClaudePerplexityGoogle AIGrok

Build the address to open on your phone

The example address is a placeholder. Replace it with your Mac’s Wi-Fi address and the port your server actually uses.

Open this address on your phone

http://192.168.1.20:5173/

Runs in this page. Your entries aren’t sent or saved. This builds an address; it doesn’t scan your network, start a server, change your firewall or create a tunnel.

1. Find the Mac’s address and server port

Open System Settings → Wi-Fi → Details for the connected network and find its IP address. For Ethernet, use that connection’s details instead. Enter the private IPv4 address into the builder; 192.168.1.20 is only an example.

Read the address printed by your dev server. Use its actual port, including any automatic fallback from 5173 to 5174. Put the page path, such as /dashboard, in the last field. Don’t enter a router’s public address or 0.0.0.0 as the Mac’s address.

2. Let the server listen on the network

Vite normally listens on localhost. If your package.json dev script runs Vite, start it with:

npm run dev -- --host 0.0.0.0

This changes where the dev server listens; it doesn’t make 0.0.0.0 the address to type on a phone. Use the private address from step 1. Vite documents this under server.host. Use a trusted network and stop the server when finished; you don’t need router port forwarding for this.

3. Open the built URL on your phone

  1. Connect the phone and Mac to the same reachable local network. Guest Wi-Fi can isolate devices even when the network names match.
  2. Copy the generated URL to the phone using your usual sharing method, then open it in the browser.
  3. If it times out, check the Mac’s address, the actual port, the server host binding and whether the firewall allows that server. Keep the firewall enabled; investigate the relevant app rule.

A successful URL calculation is not a successful connection test. This page deliberately makes no requests to your private network.

The page loads, but API calls still fail

A frontend can load from the Mac while still requesting http://localhost:3001/api. On the phone that request goes to the phone, not the Mac. Check the browser’s network error and your API base URL. Use an appropriate development proxy or a reachable backend address; changing the frontend URL alone doesn’t fix API routing.

Follow the full phone-testing guide for the Vite proxy example, or share localhost if you need a separate remote-access workflow. For the meaning of loopback addresses, see MDN’s explanation.

When the port belongs to a different project

If you have several servers running, verify which project owns the port before opening it on a phone. See every dev server on your Mac, or use Portlivo’s sharing feature for the existing app workflow. The free builder above works without installing Portlivo.

Questions people ask

Can I open localhost on my phone?
Localhost refers to the device opening the address. To reach a server on your Mac, use the Mac’s private network address and the server’s actual port, with the server listening beyond loopback.
Does this tool scan my Wi-Fi or create a tunnel?
No. It only constructs an HTTP or HTTPS URL from your entries, locally in the browser. Network reachability and certificates need to be configured separately.

Try Portlivo free for 7 days. Every feature, no account.Then $8.99 once, no subscription.

Download for Mac

Still have a question?

Write to us — a real developer reads every email and replies personally.

support@portlivo.com