Phone / tablet / desktop

Mobile Website Preview

Paste a page's HTML and CSS and see it at phone, tablet and laptop widths at the same time. The preview also flags a missing viewport tag, the most common reason a site looks tiny on phones. Everything runs in your browser.

Three widths side by sideCustom width and landscapeFlags a missing viewport tag
Try it here

Preview your page at three widths

Paste a complete page, or a fragment with its CSS in a style block, then select Preview. Scroll inside each frame to see the rest of the page.

Options

Scripts do not run here, and only https images, stylesheets and fonts load, so relative file paths will not resolve. The frames show layout at each width; they do not reproduce touch input, browser toolbars or screen density, so check important pages on a real phone too.

HCODX / device preview
Responsive layouts

What a side-by-side preview shows

Most layout bugs on phones are width bugs. Seeing several widths at once makes them obvious.

When you build on a laptop, it is easy to miss what happens on a narrow screen: a navigation bar that wraps onto three lines, cards that stay side by side until they are too thin to read, or a wide image that pushes the whole page sideways. Placing a phone, a tablet and a laptop next to each other shows where each part of the layout changes and where it breaks.

The default widths are 390 pixels, the width of many current phones, 768 for a tablet held upright, and 1280 for a small laptop. These are CSS pixels, the unit your stylesheet uses. A phone that is 390 CSS pixels wide may have three times as many physical pixels, which makes text sharper but does not change the layout. Enter a custom width to test the narrowest phone you support, such as 360 or 320.

One problem a frame cannot reproduce is a missing viewport tag, because each frame always lays the page out at its own width. On a real phone, a page without that tag is laid out about 980 pixels wide and then shrunk to fit the screen. The tool checks your source for the tag and warns you when it is missing or incomplete.

Breakpoints side by side

Phone, tablet and laptop frames update together from the same source.

Viewport check

A warning appears when the page lacks the meta tag phones need.

Private by design

The preview runs in your browser in sandboxed frames; nothing is uploaded.

The essential tag

The one line that makes a page mobile-friendly

Without it, phones pretend to be a desktop screen and shrink your page to fit.

Put this tag inside the head of every page. width=device-width tells the phone to use its real screen width for layout, and initial-scale=1 starts the page at normal zoom. Your media queries only work as intended on phones once this tag is present.

Avoid adding user-scalable=no or maximum-scale=1. They stop visitors from zooming in, which makes text hard to read for many people, and the preview notes it when it finds them.

Viewport meta tag
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My page</title>
</head>
Checklist

What to check at each width

Look at the phone frame first; most problems appear there.

01

Nothing scrolls sideways

If a frame scrolls horizontally, something is wider than the screen. Common causes are fixed widths, wide tables, long words and images without max-width: 100%.

02

Text is readable

Body text around 16 pixels needs no zooming. Very long lines on the laptop frame are hard to read too; limit them with a max-width on the content.

03

Controls are easy to tap

Buttons and links in the phone frame should be at least about 44 pixels tall and not pressed against each other.

04

Navigation still works

Check that every important link is reachable at phone width, either visible or behind a clearly labeled menu button.

When the layout is right, test the final page on at least one real phone; the next section explains why.

Know the limits

What a browser preview cannot tell you

A preview answers layout questions. These need a real device or a full browser test.

Input

Touch and hover

Hover menus have no hover on a touchscreen, and fingers are less precise than a mouse pointer.

Browser

Toolbars and safe areas

Mobile address bars change the visible height, and notches cut into the corners. 100vh behaves differently from the frame here.

Speed

Real performance

Phones have slower processors and networks. Large images and scripts that feel instant on a laptop can be slow on a phone.

Questions

Mobile preview questions

The page is probably missing the viewport meta tag. Phones then lay it out about 980 pixels wide and shrink it. These frames cannot show that, which is why the tool checks your source for the tag.

Most phones today are between 360 and 430 CSS pixels wide. Check the default 390, then the narrowest width you want to support with the custom width field, such as 360 or 320.

Only https URLs and inline styles load in the preview. Files referenced by relative paths, such as images/photo.jpg or css/style.css, are on your computer, not on the web. Paste the CSS into a style block or use full https addresses.

No. Scripts are disabled so pasted code cannot do anything unexpected. For layouts built by JavaScript, use the responsive design tester in the HCODX editor or the HTML Runner.

Not here. Most sites forbid being shown inside another site's frame, so a URL preview would often be blank. Open the site and use the device mode in your browser's DevTools instead.

No. The preview is built in your browser and nothing is sent to HCODX. The page forgets your code when you close it.

It swaps the width and height of those two frames so you can check landscape layouts, where the screen is wide but short.

Fix the layout while you look at it

The HCODX editor has a responsive design tester beside your files, so you can edit CSS and watch every width update.

Instant HTML Runner & Viewer with Live Preview

Need to run a short HTML, CSS and JavaScript snippet? The HTML Runner Online has a focused editing surface with live output.

Open HTML Runner Online