# How to Test Localhost on Phone and Tablet Sizes

> Three ways to check a local dev server at mobile sizes, from your desktop browser to a real phone on the same Wi-Fi, with the dev server flags you need.

Canonical: https://ihatebugs.dev/guides/test-localhost-on-mobile
Last updated: 2026-10-17

Updated 2026-10-17.

**To test localhost at mobile sizes, open your dev server in a mobile simulator or DevTools device mode on your computer. To see it on a real phone, start the dev server on your network address (for example with `--host`) and open `http://<your-computer's-IP>:<port>` on a phone connected to the same Wi-Fi.** You don't need to deploy first.

## 1. On your computer: simulator or device mode

Both work on `http://localhost` with nothing to configure:

- The [Mobile Simulator](https://ihatebugs.dev/mobile-simulator) opens your local page in a phone or tablet frame at the device's CSS viewport, on the same tab.
- Chrome DevTools device mode resizes the page to a preset ([Chrome docs](https://developer.chrome.com/docs/devtools/device-mode)).

This catches most layout bugs: overflow, cramped text, broken grids and fixed elements in the wrong place.

## 2. On a real phone: use your network address

By default most dev servers listen only on `localhost`, which a phone can't reach. Make the server listen on your network instead:

| Tool | Command |
| --- | --- |
| Vite | `vite --host` |
| Astro | `astro dev --host` |
| Next.js | `next dev -H 0.0.0.0` |

The terminal then prints a network URL such as `http://192.168.1.20:5173`. Open it on a phone connected to the same Wi-Fi. If it doesn't load, check that your computer's firewall allows the port.

Some features need a secure context (HTTPS or `localhost`), for example service workers and the clipboard API. On a network address over plain HTTP they will not work; test those over a tunnel or with a local HTTPS setup.

## 3. On a real phone over USB

- **Android:** enable USB debugging, connect the phone and open `chrome://inspect` on your computer. Port forwarding makes `localhost:3000` on the phone reach your computer's `localhost:3000`, which keeps it a secure context ([Chrome remote debugging](https://developer.chrome.com/docs/devtools/remote-debugging)).
- **iPhone:** connect it to a Mac and use Safari's Web Inspector to debug the page you opened on the phone.

## Which sizes to check

Test the edges: about 360px for small Android phones, 393px for current iPhones, 440 to 448px for the largest phones and 820px for a tablet. The [screen size lists](https://ihatebugs.dev/screen-sizes) have every preset, and [responsive breakpoints](https://ihatebugs.dev/guides/responsive-breakpoints) explains how these widths map to media queries.
