Capture Same Web Page at Multiple Mobile Sizes
In this article
This guide shows you how to capture screenshots of a single web page at multiple mobile device sizes—useful for responsive design checks, client presentations, or documentation. You'll learn both a quick browser-based method and a more precise command-line approach. No special software is required beyond a modern browser and, optionally, a free tool called Puppeteer.
What You'll Need
- A modern web browser (Chrome, Edge, Firefox, or Safari) with developer tools.
- The URL of the page you want to capture.
- Optional: Node.js installed on your computer if you want to automate the process with Puppeteer.
Step-by-Step
Method 1: Using Browser Developer Tools (Manual)
- Open the page in your browser. Navigate to the web page you want to capture.
- Open Developer Tools. Right-click anywhere on the page and select "Inspect" (or press F12 on Windows/Linux, Cmd+Option+I on Mac).
- Switch to device emulation. In the DevTools panel, click the device toolbar icon (a small rectangle with a phone outline) in the top-left corner, or press Ctrl+Shift+M (Cmd+Shift+M on Mac). The page will switch to a mobile viewport.
- Set the device size. At the top of the device toolbar, you'll see a dropdown with preset device names (e.g., iPhone 12, Pixel 5). Select one, or click the dimensions field to type custom width and height in pixels. For example, enter 375 for width and 667 for height to simulate an iPhone SE.
- Adjust the viewport to capture the full page. By default, the viewport shows only the visible area. To capture the entire page height, you need to set a larger height. In the dimensions field, increase the height to a large value like 2000 or more, depending on the page length. Alternatively, use the "Responsive" option and drag the handles to the desired size.
- Take the screenshot. Click the three-dot menu (⋯) in the device toolbar and select "Capture full size screenshot." The browser will save a PNG image of the full page at that device size.
- Repeat for other sizes. Change the width and height values to your next target size (e.g., 768×1024 for tablets) and take another full-size screenshot. Save each image with a descriptive filename like
home-375x667.png.
Method 2: Using Puppeteer (Automated)
- Install Node.js. If you don't have it, download and install Node.js from the official website (nodejs.org). Verify installation by running
node -vin your terminal. - Create a project folder. Make a new directory for your script and navigate into it in your terminal.
- Initialize npm. Run
npm init -yto create a package.json file. - Install Puppeteer. Run
npm install puppeteer. This downloads a compatible Chrome browser for automation. - Write the script. Create a file named
screenshot.jsand add the following code:const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); const sizes = [ { width: 375, height: 667, name: 'mobile' }, { width: 768, height: 1024, name: 'tablet' }, { width: 1366, height: 768, name: 'desktop' } ]; for (const size of sizes) { await page.setViewport({ width: size.width, height: size.height }); await page.goto('https://example.com', { waitUntil: 'networkidle2' }); await page.screenshot({ path: `screenshot-${size.name}.png`, fullPage: true }); } await browser.close(); })(); - Run the script. In your terminal, run
node screenshot.js. The script will visit the page at each specified size and save full-page screenshots as PNG files in the same folder. - Customize sizes and URL. Edit the
sizesarray and the URL inpage.goto()to match your needs. You can add as many sizes as you like.
Common Mistakes
- Forgetting to set full-page capture. Using the regular screenshot button only captures the visible viewport, not the entire page. Always use "Capture full size screenshot" or
fullPage: truein Puppeteer. - Using the wrong device dimensions. Some devices have different CSS pixel ratios (e.g., iPhone 12 has a 390×844 CSS viewport, not the physical 1170×2532 pixels). Use the device presets in DevTools to get accurate CSS dimensions.
- Not waiting for the page to load. If you capture too quickly, images and fonts may not load, resulting in incomplete screenshots. In Puppeteer, use
waitUntil: 'networkidle2'to ensure the page is fully loaded. - Ignoring scroll behavior. Some pages have fixed elements or lazy-loaded content that only appears when scrolled. Full-page screenshots may miss these. Consider scrolling manually or using a script to scroll and capture.
Tips
- Use a consistent naming convention. Name files with the device or dimensions, e.g.,
home-iphone12.png, to keep things organized. - Test with real device sizes. Use the device presets in DevTools—they include proper device pixel ratio and user agent, which can affect how the page renders.
- Check responsive breakpoints. Capture at common breakpoints like 320px, 375px, 768px, and 1024px to cover most devices.
- Use a headless browser for automation. Puppeteer runs in headless mode by default, so it won't open a visible browser window. This is fine for screenshots.
- Consider using a service like BrowserStack. For large-scale testing, cloud services can capture screenshots across many real devices, but they cost money. The local methods above are free.
Troubleshooting
- Screenshot is blank or white. This often happens when the page hasn't loaded completely. Increase the wait time in Puppeteer by changing
waitUntilto'networkidle0'or adding a delay withawait page.waitForTimeout(2000). - The full-page screenshot is cut off. Some pages have a fixed height that prevents full-page capture. Try setting a very large viewport height (e.g., 10000) in DevTools, or use Puppeteer's
fullPage: truewhich automatically scrolls and stitches the page. - Device toolbar doesn't show the "Capture full size screenshot" option. This option appears only when the device toolbar is active. Make sure the toolbar is enabled (the icon is highlighted). If not, click the three-dot menu and check "Capture full size screenshot" is available.
- Puppeteer fails to install. This can happen due to network issues or missing dependencies. Try running
npm install puppeteer --ignore-scriptsand then manually install Chrome vianpx puppeteer browsers install chrome. - Images are missing in the screenshot. Some images load lazily when scrolled into view. In Puppeteer, you can scroll through the page before capturing by adding a loop that scrolls to the bottom and back to the top.
Frequently Asked Questions
Can I capture screenshots at multiple sizes without coding?
Yes, you can use browser DevTools manually for each size, which is fine for a few screenshots. For many sizes, the Puppeteer script is more efficient.
What is the best way to capture a full-page screenshot?
In Chrome DevTools, use the "Capture full size screenshot" option. In Puppeteer, set fullPage: true in the screenshot options.
Do I need to use a real device for accurate screenshots?
Not necessarily. DevTools emulation is accurate for most layout testing. However, for performance or hardware-specific features, real devices are better.
Can I automate screenshots with other tools like Selenium?
Yes, Selenium WebDriver can also take screenshots, but Puppeteer is simpler for this task because it's designed for Chrome and has built-in full-page capture.
How do I capture screenshots on a Mac?
You can use the same browser DevTools method. For automation, Puppeteer works on Mac as well. Just ensure Node.js is installed.
What file format should I use for screenshots?
PNG is best for screenshots because it's lossless and preserves text sharpness. JPEG may be smaller but can introduce artifacts.