How do you test a local website on a real phone?

Test a local website on a phone by serving it from the development computer and opening the computer’s private network address on the phone. Both devices normally need the same local network, and the server must listen on an address reachable beyond localhost. Do not expose a development server to the public internet without access controls.
Start the project with its host set to 0.0.0.0 or the framework’s network option. Find the computer’s LAN address, such as 192.168.1.25, then open that address with the development port on the phone. Keep the operating-system firewall limited to the local network and close the port after testing.
npm run dev — –host 0.0.0.0
# Open on the phone:
http://192.168.1.25:5173
A hostname, local proxy or secure tunnel is useful when the project needs HTTPS, service workers, camera permissions or OAuth callbacks. Use a trusted local certificate or a controlled tunnel service. Never place production credentials in a client bundle, and treat a shared testing URL as reachable by anyone who receives it.
If the phone cannot connect, confirm that the server is listening on the LAN interface, the address has not changed, both devices use the same Wi-Fi segment, and client isolation is disabled. VPNs, guest networks and corporate firewalls commonly block device-to-device traffic. Try the computer’s browser using its own LAN URL before debugging the phone.
Once the page loads, use Chrome remote debugging for Android or Safari Web Inspector for iPhone. Inspect real computed styles, network requests and console errors while operating the phone normally. Test rotation, keyboard input, slow connections and sleep or resume because these states are absent from a simple desktop preview.