What does the viewport meta tag do on a mobile website?

The viewport meta tag tells mobile browsers how to size the page’s initial layout viewport. Without it, a browser may use a wide virtual viewport, often around desktop proportions, then shrink the page to fit the phone. The result looks zoomed out and prevents narrow media queries from behaving as intended.
A common responsive setting is:
<meta name="viewport" content="width=device-width, initial-scale=1">
width=device-width matches the layout viewport to the device width in CSS pixels. initial-scale=1 requests a 1:1 initial scale. The tag belongs in the document head and should appear once.
The viewport tag does not make a layout responsive by itself. Fixed-width containers, oversized images and absolute positioning can still overflow. Add the tag together with flexible CSS and responsive media, then test narrow widths and remove desktop assumptions that scaling might hide.
Avoid settings that disable user zoom, such as user-scalable=no or restrictive maximum scales. Users with low vision need magnification, and modern browsers may ignore some restrictions. Keep content usable at high zoom and account for safe areas separately when full-bleed layouts extend into display cutouts. Recheck the component after font, spacing or browser-support changes. Responsive failures often return when a shared token changes, so the test should cover the limiting content state instead of one ideal screenshot. Verify the final behavior across the full width range, including the spaces between preset devices and design breakpoints. Long labels, translated copy and enlarged text often reveal constraints that short demo content does not exercise.