Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To set the page’s viewport in Puppeteer, use await page.setViewport({ width: 1080, height: 1024 }). If you mean the browser window’s content area, outer bounds, or headless screen instead, use a different control: page.resize(), browser.setWindowBounds(), or launch-time screen options, respectively.

Choose which size you need

“Browser window size” can refer to several different dimensions. Picking the control that matches your goal avoids a common mismatch: changing the viewport does not necessarily resize the operating-system window, and setting a window’s bounds is not the same as setting a page’s layout viewport.

What you want to control Puppeteer control When to use it
Page viewport page.setViewport() Set the page’s layout and visible area to a particular width and height.
Browser window content area page.resize() Request a width and height for the content area, excluding browser UI. This API is experimental.
Window bounds, position, or state browser.setWindowBounds() Set bounds such as left, top, width, and height, or change window state.
Headless screen at launch --window-size or --screen-info Configure screen dimensions as the browser starts in headless mode.

Puppeteer documentation version 25.12.0 documents these separate controls. See the Window management guide, Screen configuration guide, and Page API reference.

Set the page viewport

Use page.setViewport() when you want a page to render at a particular viewport size—for example, to capture a desktop layout or test a responsive breakpoint. Puppeteer’s documented default viewport is 800 by 600 pixels; setting it explicitly makes your intended dimensions clear.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const page = await browser.newPage();
await page.setViewport({ width: 1080, height: 1024 });
await page.goto('https://example.com');

The width and height are viewport dimensions, not a promise about the outer dimensions of a visible Chrome window. A viewport belongs to a page, so use this method when page layout is what matters. Puppeteer’s Getting started guide uses this form.

Viewport behavior to account for

  • Set the viewport before navigating when the initial page load should use the target dimensions.
  • Use integer pixel values for width and height. Choose dimensions that match the layout or device scenario you are testing.
  • If you are emulating a mobile device, viewport width and height are only part of the configuration; use Puppeteer’s device emulation approach when you also need device-specific behavior.
  • Do not infer the physical browser-window size from window.innerWidth alone if you need outer window bounds or browser chrome dimensions.

Resize the browser window’s content area

If the goal is for the page content area—not the outer window including browser UI—to have a requested size, the current Puppeteer Window management guide shows this pattern:

await page.setViewport(null);
await page.resize({ contentWidth: 600, contentHeight: 400 });

page.setViewport(null) removes the configured viewport constraint in this documented example. Then page.resize() requests a 600-by-400 content area. The Page API marks Page.resize experimental, so its availability or behavior may change; verify the current API documentation before relying on it in a long-lived automation setup.

The guide’s example reports window.innerWidth and window.innerHeight as 600 and 400, while window.outerWidth and window.outerHeight are 600 and 487 in that example environment. The extra outer height is not a universal constant: browser chrome and platform environment affect it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set window bounds, position, or state

Use the browser window-management methods when you need to control the actual window bounds or state rather than only the page viewport. The documented flow obtains a window ID, reads its bounds if needed, then applies a bounds object with values such as left, top, width, height, or windowState.

const windowId = await browser.getWindowForTarget(page.target());
const currentBounds = await browser.getWindowBounds(windowId);

await browser.setWindowBounds(windowId, {
  left: 40,
  top: 40,
  width: 1200,
  height: 900,
  windowState: 'normal'
});

The exact browser and Puppeteer environment can affect whether a visible window exists and how bounds are applied. Use the Window management guide for the current method signatures and supported state values. If your actual purpose is page rendering, a viewport setting is usually the more direct control.

Configure headless screen dimensions at launch

For headless runs, Puppeteer’s Screen configuration guide describes a default headless screen of 800 by 600 when --screen-info is absent, unless --window-size is specified. When --window-size is specified, the headless screen is as large as the requested window size. Puppeteer launch options accept extra browser command-line arguments through args.

const browser = await puppeteer.launch({
  headless: true,
  args: ['--window-size=1440,900']
});

const page = await browser.newPage();
await page.goto('https://example.com');

The --screen-info option is headless-only; it is not the way to configure physical platform screens for headful Chrome. If you need a headless screen configuration beyond the window-size behavior described above, consult the current Screen configuration guide rather than assuming launch dimensions and page viewport are interchangeable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a complete script

This example sets a fixed viewport, navigates to a page, and prints the viewport dimensions reported by the page. It illustrates viewport control; it does not claim to measure the browser window’s outer bounds.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1440, height: 900 });
    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

    const size = await page.evaluate(() => ({
      innerWidth: window.innerWidth,
      innerHeight: window.innerHeight
    }));
    console.log(size);
  } finally {
    await browser.close();
  }
})();

For a module-based project, use your project’s existing import style in place of require. The sizing call is unchanged. The finally block ensures the browser is closed even if navigation or evaluation fails.

Or skip the browser setup

If your goal is to obtain a webpage screenshot rather than control a Puppeteer browser, ScreenshotNeo provides a screenshot API. One GET request can return an image or PDF. For example, save a WebP capture with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. It can accept cookie or consent banners and remove known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month with no card.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot sizing problems

The page is still 800 by 600

Check that setViewport() is called on the page you navigate, and that it runs before navigation if the initial rendering needs the new dimensions. Puppeteer documents 800 by 600 as its default viewport; a different page or later viewport configuration may explain why the dimensions did not change.

The visible browser window is not the requested size

page.setViewport() controls the page viewport, not necessarily the browser’s outer bounds. If you need the content-area dimensions, use the documented page.setViewport(null) followed by page.resize() pattern, bearing in mind that Page.resize is experimental. If you need position or actual window bounds, use the window ID and browser.setWindowBounds().

The content area matches, but outer dimensions do not

This is expected when browser UI is included in the outer measurement. The Puppeteer guide’s example has an outer height larger than the content height, but the difference depends on the browser chrome and environment. Do not hard-code that example’s difference as a general conversion.

A launch argument appears to have no effect

Confirm that the argument is supplied in puppeteer.launch({ args: [...] }) and that you are using the headless configuration the option addresses. In particular, --screen-info is documented as headless-only; it does not configure physical screens for headful Chrome. For a page-specific rendering target, set the page viewport explicitly instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Resizing works in one environment but not another

Separate the intended target—viewport, content area, window bounds, or headless screen—and use the matching API. Browser UI and platform behavior influence outer bounds, while the experimental status of Page.resize is a reason to check the API reference for the Puppeteer version you run.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

Choose the narrowest control that satisfies the task. For responsive layout checks or consistent page screenshots, an explicit viewport is straightforward and page-scoped. Window bounds are appropriate when automation needs a positioned or stateful browser window. Launch-time screen settings are useful when the headless screen itself matters. Avoid layering multiple sizing controls without checking the resulting page dimensions, because viewport and window geometry refer to different things.

The Puppeteer documentation cited here is version 25.12.0, accessed September 29, 2026. API behavior and experimental labels can change; confirm the referenced documentation for the version installed in your project. Puppeteer and browser execution costs depend on your runtime and hosting setup; no general price or performance benchmark is established by the sizing documentation.

Frequently Asked Questions

What is Puppeteer’s default viewport size?

The Puppeteer documentation describes a default viewport of 800 by 600 pixels.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does page.setViewport() resize the outer Chrome window?

No. It sets the page viewport. Use window-management controls when you need the browser window’s bounds.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.