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 save a 3840 × 2160 screenshot with Playwright, configure either a 3840 × 2160 CSS-pixel viewport at device scale 1, or a 1920 × 1080 viewport at device scale 2, then capture with scale: 'device'. The second setup renders four device pixels for each CSS pixel and produces the same intended output dimensions. A 4K monitor is not required: these settings control browser rendering and the saved image.

Set the viewport and device scale for 4K output

Playwright keeps viewport dimensions, device scale factor, and screenshot output scale as separate settings. The viewport is measured in CSS pixels; the device scale factor determines how many device pixels correspond to each CSS pixel. The screenshot option scale: 'device' saves one image pixel per device pixel, while scale: 'css' saves one image pixel per CSS pixel. The documented default device scale factor is 1. See the Page screenshot API and browser context options.

Viewport Device scale factor Screenshot scale Intended viewport image size
1920 × 1080 CSS pixels 2 device 3840 × 2160 pixels
3840 × 2160 CSS pixels 1 device 3840 × 2160 pixels
1920 × 1080 CSS pixels 2 css 1920 × 1080 pixels

Use the 1920 × 1080 viewport with scale 2 when you want a typical CSS layout rendered at higher pixel density. Use a 3840 × 2160 viewport with scale 1 when the page should lay out across 3840 CSS pixels. Those viewports can trigger different responsive layouts, so the choice depends on what you want the screenshot to show.

Capture a viewport-sized 4K screenshot

Install Playwright in a Node.js project and install its Chromium browser before running this script. For example, use npm install -D playwright and then npx playwright install chromium. Save the following as screenshot.js and run it with node screenshot.js:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Dell 27 Monitor S2725QS, 4K UHD IPS, 120Hz, 5ms, FreeSync Premium
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      viewport: { width: 1920, height: 1080 },
      deviceScaleFactor: 2,
    });
    const page = await context.newPage();

    await page.goto('https://example.com', { waitUntil: 'networkidle' });
    await page.screenshot({
      path: 'screenshot-4k.png',
      scale: 'device',
    });
  } finally {
    await browser.close();
  }
})();

For a viewport capture, the intended output is 3840 × 2160 device pixels. The dimensions follow from the configured 1920 × 1080 CSS viewport multiplied by device scale factor 2, with device-scale screenshot output. Confirm the saved file’s dimensions in your image viewer or with an image-inspection utility in your environment, particularly if you changed the viewport or browser configuration.

Choose what part of the page to capture

Visible viewport

page.screenshot() captures the visible viewport by default. The script above uses this behavior, so its height is controlled by the configured viewport.

Full scrollable page

Add fullPage: true to the screenshot options to capture the full scrollable page:

await page.screenshot({
  path: 'full-page-4k.png',
  fullPage: true,
  scale: 'device',
});

A full-page image can be taller than 2160 pixels because its height depends on the page’s scrollable content. Playwright describes this as a capture “as if you had a very tall screen and the page could fit it entirely”; see its Screenshots guide. Do not assume fullPage: true produces a 3840 × 2160 file: it changes the capture extent, not the page’s content height.

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.
Rank #2
Sale
LG 27US500-W Ultrafine Monitor 27-Inch 4K UHD (3840x2160) HDR10 IPS Borderless Design Reader Mode Flicker Safe Switch App HDMI DisplayPort - White
  • 4K UHD with 1000:1 Contrast Ratio - This UltraFine display with a 1000:1 contrast ratio displays deeper blacks and vivid colors in UHD clarity. With wide viewing angles, it gives creative professionals the ability to view and work with highly-detailed, digital imagery.
  • 4K HDR10 DCI-P3 - Explore HDR10 content the way it was meant to be seen with up to 90% DCI-P3 color gamut expression—an elevated color spectrum that brings brilliant color to life.
  • Onscreen Control - You can customize the workspace by splitting the display or adjusting basic monitor options with just a few mouse clicks.
  • Ergonomic Stand - The ergonomic stand makes it easy to flexibly adjust the tilt of the screen in the optimal position for you.
  • What's In The Box - Stand Body, Stand Base, Screws, Power Adapter, HDMI Cable, Quick Start Guide, Registration Card, Warranty.

One element

For a single element, use a locator screenshot rather than the discouraged older ElementHandle screenshot method. For example:

await page.locator('main').screenshot({
  path: 'main-4k.png',
  scale: 'device',
});

The resulting dimensions depend on the element’s rendered size and device scale factor; a locator capture is not necessarily 3840 × 2160. See the Locator screenshot API.

Wait for the right page state

The sample uses waitUntil: 'networkidle' before capture. This waits for network activity to become idle, but a site that continuously polls or loads resources may not reach that state. If navigation does not finish, choose a page-specific readiness condition instead: wait for a selector that identifies the content you need, or use a deliberate delay when the page needs time for a known animation or update. For example:

await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.locator('main').waitFor({ state: 'visible' });
await page.screenshot({ path: 'screenshot-4k.png', scale: 'device' });

Use the condition that matches the site and the content being captured; a visible container does not necessarily mean every image or dynamic widget inside it has finished loading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 32 Monitor S3225QS, 4K UHD VA, 120Hz, FreeSync Premium, Eye Comfort
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in 4K visuals with a VA panel. Enjoy true-to-life colors with 99% sRGB and 95% DCI-P3 coverage. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.

Make screenshots reproducible

Matching viewport and scale settings is necessary for consistent dimensions, but it does not guarantee identical pixels across machines. Playwright warns that screenshot rendering can vary with the host operating system, browser version, settings, hardware, power source, and headless mode. For visual baselines, generate both the reference and comparison screenshots in the same rendering environment. See the visual comparisons guidance.

  • Keep the Playwright and browser versions, operating system, headless mode, and relevant browser settings consistent.
  • Use the same viewport, device scale factor, and screenshot scale for each run.
  • Check the actual output dimensions, especially after switching between viewport and full-page capture.

Troubleshoot common 4K capture problems

The image is 1920 × 1080 instead of 3840 × 2160

Check that the context uses deviceScaleFactor: 2 and that page.screenshot() uses scale: 'device'. With scale: 'css', output is one pixel per CSS pixel, so a 1920 × 1080 viewport produces a 1920 × 1080 image.

The page layout changed

A 3840 × 2160 CSS viewport is not equivalent to a 1920 × 1080 viewport at device scale 2. The former gives the page more CSS-pixel width and height, which can change responsive breakpoints and the visible content. Pick the viewport based on the layout you need, then choose the device scale based on output density.

The full-page image is much taller than 2160 pixels

This is expected when fullPage: true captures a long scrollable document. If you need an image exactly 3840 × 2160, capture the viewport instead and omit fullPage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Odyssey G5 (G51F) Series QHD (1440P) Gaming Monitor
  • QHD Resolution (2560 x 1440) has 1.7 times the pixel density of Full HD for incredibly detailed pinsharp images
  • HDR10 provides brighter highlights and nuanced shadow for added depth - making every scene feel more vivid and realistic
  • The 180Hz refresh rate minimizes lag for gameplay with ultra-smooth action. Plus, the 1ms response time helps capture your moves in real-time, allowing you to react fast for gaming precision
  • AMD FreeSync reduces choppiness, screen lag and image tearing, ensuring that your fast-paced, complex in-game action is stable with minimal stutter
  • Ergonomic stand allows for tilt, pivot and height adjustments to maximize gaming comfort

Navigation waits indefinitely or times out

Some pages keep network connections active or continually fetch data, so networkidle may not be suitable. Navigate to a less restrictive readiness point such as domcontentloaded, then wait for the specific content needed for the screenshot.

Screenshots differ across runs or computers

Differences can come from the browser and host rendering environment, not just screenshot options. Use the same environment for baseline and comparison captures, including browser version and headless mode.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A single request can return an image or PDF; its options include viewport and device presets, full-page capture, and image format controls. See the ScreenshotNeo API documentation for the available parameters.

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

ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether the request was billed. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

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

Sign up for ScreenshotNeo free to get 1,000 screenshots a month with no card.

Best Value
Sale
Dell 27 Monitor S2725QC, 4K UHD IPS, 120Hz, 99% sRGB, 4ms, FreeSync Premium
  • Low blue light: The improved ComfortView Plus reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Easy connectivity: Keep your desk organized and clutter-free with a single USB-C cable (up to 65W power delivery).

Frequently Asked Questions

Do I need a 4K monitor to save a 4K screenshot with Playwright?

No. The viewport and device scale settings determine browser rendering and image output; a physical 4K display is not required.

Does a 4K screenshot always have to use a 3840 × 2160 viewport?

No. A 1920 × 1080 CSS viewport at device scale factor 2 with device-scale capture produces the intended 3840 × 2160 output while retaining the smaller CSS layout.

Can Playwright capture a particular page element at high resolution?

Yes. Use a locator’s screenshot method with `scale: ‘device’`; the output dimensions depend on the element’s rendered size.

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

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.