Share Your Local HTML Website on Mobile Using VS Code Live Server

Hello, I’m Badhon. I tend to forget things easily, which is why I started this blog.
When developing a simple HTML website, testing it directly on a mobile device connected to the same WiFi network is often more reliable than using browser emulators. Visual Studio Code provides an easy way to make your local site accessible on your phone using the Live Server extension.
Step 1. Install Live Server Extension
Install the extension from the official marketplace:
https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

Step 2. Allow Live Server to Listen on All Network Interfaces
Open VS Code Settings and search for liveServer.settings.host
By default, it is set to 127.0.0.1
Change it to 0.0.0.0
Restart or reopen Live Server after this change

Step 3. Access the Website from Mobile
Once Live Server is running, your site will be available at http://YOUR_LOCAL_IP:5500/
Replace YOUR_LOCAL_IP with your computer’s actual IP address on the local network.
Finding Your Local IP Address
Linux
Run the following command ip a
Find the IP under your WiFi interface, often named wlan0 or wlp0s0.
Windows
Open Command Prompt and run ipconfig
Look for the IPv4 Address under your WiFi adapter.
macOS
Open Terminal and run ipconfig getifaddr en0
If you are on a wired connection, use en1 instead.
After retrieving your IP address, type http://YOUR_LOCAL_IP:5500/
in your mobile browser while connected to the same WiFi network. Your HTML website will now load on the phone exactly as it would for real users.



