How do you access a website running on localhost from iPhone browser

Accessing localhost from the iPhone will simply do a loopback / try to connect to itself (If it supports that?).

What you need to do is find the IP of your desktop machine (e.g. If Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status.

Once you have your ip, simply visit that from your browser e.g. http://192.168.0.102.

You may need to open up port 80 (or whatever port your website is running on) in the inbound security of your firewall if you are running one.

Note: don't forget the app's port if what you want is to debug the app in your iPhone's browser like: http://192.168.0.102:3000. In this example 3000 is the default port used by ReactJS.


If you are using Mac, go to System Preferences > Network and use your IP address instead of localhost. You can also use port number. In my case, I have a server running on port 1448 and I can preview 192.168.1.241:1448 using iPhone.

MacOsNetworkSettings


you can try ngrok.io. Works on same principle as localtunnel.
Download the application for your os. and try to run like:

for linux:

./ngrok http 8000

8000 is port number your application is running on.

for windows:

 ngrok.exe http 8000

Try this:

  1. Press Windows + R
  2. Open cmd
  3. Run ipconfig (Old) ifconfig (New)
  4. Check your wireless network card IP
  5. Go to iPhone and navigate to "http://xxx.xxx.xxx.xxx/" through your browser.
    (xxx.xxx.xxx.xxx is your IP)

Note: you must set permission on your firewall settings, if any.