# Viewport Meta Tag

> One line of HTML that makes a page fit the width of a phone screen.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Meta Viewport, width=device-width, Viewport Meta Element

## Think of it like

It is like telling a tailor your real size. Then the shirt fits you, not a giant.

## Definition

The viewport meta tag is one line of HTML that tells a phone how wide to lay out the page. It goes in the head of the page. Without it, many phones pretend the screen is as wide as a desktop and shrink the page down. With width=device-width, the page is laid out at the phone's real width. Media queries for small screens only work once this line is there.

## Example

Jack's new site looks tiny on his phone, and his mobile styles never kick in. He adds the viewport tag, and the page fits.

## Example code

```html
<meta name="viewport" content="width=device-width, initial-scale=1">
```

The line most pages use. It sets the page width to the screen width, at normal zoom.

## Why it matters

It is the first step of any page that works on phones. Without it, responsive design does not work at all.

## Common mistake

Adding user-scalable=no to stop zoom. People who need bigger text can then not zoom in.

## Three principles

- **One line.** It goes in the head of the page.
- **Real width.** The page is laid out at the screen width.
- **Let people zoom.** Never turn zoom off.

## Related terms

- [Viewport](https://learn.benibix.com/term/design/viewport)
- [Media Query](https://learn.benibix.com/term/development/media-query)
- [Responsive Web Design](https://learn.benibix.com/term/design/responsive-web-design)
- [HTML Element](https://learn.benibix.com/term/development/html-element)
- [HyperText Markup Language (HTML)](https://learn.benibix.com/term/development/html)

## Told apart from

- [Viewport vs Viewport Meta Tag](https://learn.benibix.com/compare/viewport-vs-viewport-meta-tag): People think the viewport and the viewport meta tag are the same thing, and they are not. The viewport is the part of the page you can see on the screen. The viewport meta tag is one line of HTML that tells a phone how wide that view should be. The tag sets the viewport; it is not the viewport.

## Taught in

- [Responsive Web Design](https://learn.benibix.com/learn/development-web/responsive-web-design): HTML, CSS and JS, 10/14

![Two phones side by side. The left phone has no viewport tag, so a wide desktop page is shrunk to fit and its text is tiny. The right phone has the tag, meta name viewport content width=device-width, so the page is laid out at the phone's own width and the text reads at a normal size.](https://learn.benibix.com/diagrams/dev5-viewport-meta.svg)

---

Source: https://learn.benibix.com/term/development/viewport-meta-tag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
