Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Mountain View desk5 min

How to Set Device Pixel Ratio for Mobile Website Screenshots in Puppeteer

Set Puppeteer's deviceScaleFactor in the viewport before navigating, or emulate a bundled device profile for mobile screenshots.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set deviceScaleFactor in the viewport with page.setViewport() before you navigate, then capture the page with page.screenshot(). For example, this uses an illustrative 390-by-844 CSS-pixel viewport at a scale factor of 3; those values are not a recommendation for a particular phone.

Set a manual mobile viewport and device scale factor

In Puppeteer, the page viewport configuration is where you choose the emulated device pixel ratio for this screenshot workflow. Set it before calling page.goto() so the page loads under the intended conditions:

As an Amazon Associate I earn from qualifying purchases.

const page = await browser.newPage();

await page.setViewport({
  width: 390,
  height: 844,
  deviceScaleFactor: 3,
  isMobile: true,
  hasTouch: true,
});

await page.goto('https://example.com');
await page.screenshot({ path: 'mobile.png' });

The width and height are viewport dimensions, and deviceScaleFactor sets the emulated scale. Confirm supported viewport fields against the Puppeteer Viewport API for the version you use. Puppeteer warns that changing the viewport resizes the page and that changes to mobile or touch properties can reload it. Applying the configuration before navigation avoids changing those conditions after the site has loaded.

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

Use a bundled profile when you want a named device

If the goal is to approximate a known device profile rather than select each setting yourself, use Puppeteer’s KnownDevices and page.emulate() before navigation:

#1 Best Overall
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
import { KnownDevices } from 'puppeteer';

const page = await browser.newPage();
await page.emulate(KnownDevices['iPhone 17 Pro']);
await page.goto('https://example.com');
await page.screenshot({ path: 'mobile.png' });

page.emulate() is a shortcut that applies device metrics and a user agent through the equivalent of page.setUserAgent() and page.setViewport(). The bundled device list can change between Puppeteer versions, so check the profile name and current API when updating Puppeteer. The official guidance recommends emulating before navigation because some sites do not expect their viewport to change after loading.

Choose manual settings or a device profile

Approach Use it when What it configures
Manual page.setViewport() You need direct control of width, height, scale factor, or supported mobile and touch flags. The viewport metrics and options you specify.
page.emulate(KnownDevices[...]) You want a Puppeteer-bundled named profile rather than choosing its metrics individually. Device metrics and a user agent.

Neither method is established as universally more accurate for every website. Choose based on the viewport dimensions, pixel density, user-agent behavior, and mobile or touch behavior the page needs.

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to | Prepaid Smartphone- 6.6" 120Hz Display, 5G , 50MP Quad Pixel Camera, Long-Lasting Battery
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.

Do not confuse viewport emulation with screen configuration

deviceScaleFactor is the viewport-emulation setting used to choose scale for the page screenshot. Puppeteer’s separate ScreenInfo API includes a devicePixelRatio field for reported screen information, and the headless screen-configuration guide covers configuring screens. That separate screen API does not replace the viewport setup for ordinary page emulation.

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

Device pixel ratio is also separate from the region captured. Screenshot options such as fullPage, clip, and captureBeyondViewport affect what area is captured; they are not substitutes for setting the viewport’s scale factor.

Rank #3
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Capture the viewport, a region, or the full page

A basic screenshot can infer its image type from the filename extension; PNG is the documented default. Use screenshot options to change the captured area or format:

  • page.screenshot({ path: 'mobile.png' }) captures a normal screenshot.
  • fullPage: true requests a full-page capture.
  • clip specifies a region to capture.
  • captureBeyondViewport controls capturing outside the viewport in relevant cases.
  • JPEG quality applies to formats that support it; it does not apply to PNG.

For example, to save the full page as a JPEG:

await page.screenshot({ path: 'mobile.jpg', type: 'jpeg', quality: 85, fullPage: true });

For a clipped area, supply its position and dimensions in CSS pixels:

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black | Privacy Display, Galaxy AI, AI Camera, Super Fast Charging 3.0, Durable Battery, 2026, US 1 Year Warranty
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
await page.screenshot({
  path: 'header.png',
  clip: { x: 0, y: 0, width: 390, height: 160 },
});

Capture behavior and final dimensions can depend on capture mode and browser implementation; the documented options do not establish a universal output-dimension rule across backends.

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

Use a deliberate navigation and readiness sequence

  1. Create a page from your Puppeteer browser.
  2. Apply a manual viewport or a named device profile before navigation.
  3. Navigate to the target URL.
  4. Wait for the page state required by the screenshot, then call page.screenshot() with the desired capture options.

The right readiness condition depends on the site’s network activity and rendering. A navigation wait condition that works for one page may be unsuitable for another. Puppeteer’s screenshot guide demonstrates navigation waiting and screenshot capture; choose a condition appropriate to the page you are capturing rather than assuming one condition fits all sites.

Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included | Prepaid Smartphone with Full YR Plan Included bundled with 1500 Min/Text/Data for365 days of service - Locked to Tracfone
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
  • ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
  • CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
  • 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common mobile screenshot problems

  • The page looks like desktop after setting mobile options. Make sure isMobile and, if needed, hasTouch are set in the viewport, or use a named device profile that also applies a user agent.
  • The page reloads or changes layout unexpectedly. Set the viewport or emulate the device before page.goto(); changing these values after loading can resize or reload the page.
  • The screenshot is the wrong size or region. Check the viewport width and height separately from screenshot options. Remove or correct clip or fullPage if the captured region is not what you intended.
  • A full-page capture omits content that appears after scrolling. The screenshot options govern capture area, but page content may also depend on lazy loading or application behavior. Wait for the required content to render before capture.
  • The screenshot has a different file type or quality than expected. Use a filename extension or explicit type appropriate to the desired format. JPEG quality is not a PNG setting.
  • A device name cannot be found. Verify the spelling against the KnownDevices list for the installed Puppeteer version; available profiles can change.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns an image or PDF, without configuring Puppeteer in your own browser process. See the ScreenshotNeo API documentation.

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 or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 shots per month with no card, and paid plans start at $5 for 3,000 shots.

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

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

Frequently Asked Questions

Does deviceScaleFactor change the CSS viewport width?

No. It is a separate viewport-emulation setting from the configured width and height.

Can I use deviceScaleFactor with Puppeteer’s KnownDevices profiles?

Use a named profile as supplied when you want its bundled device metrics and user agent; use manual viewport settings when you need direct control over the individual values.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.