October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
browser automation

How to Fix Extra White Space in Puppeteer Full-Page Screenshots

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

Extra white space in a Puppeteer full-page screenshot is usually a layout or capture-scope problem, not something that fullPage: true is designed to remove. Measure the rendered document, set the viewport before navigation, wait for the application to finish laying out, and decide whether you really need the whole document. If the required output is one component, an element screenshot is the reliable fix; if it is the entire page, correct the CSS or capture timing that makes the document taller than expected.

What fullPage actually captures

Puppeteer documents fullPage: true as taking a screenshot of the full page. It is not documented as a whitespace-removal, content-aware crop, or “trim blank margins” operation. The resulting image follows the rendered document and its layout boxes, including space created by CSS, delayed content, and containers that are taller than their visible children.

Start by identifying the intended target:

  • Entire document: keep a full-page capture and diagnose why the document height is excessive.
  • A content region or component: capture that element instead of asking a page screenshot to infer your desired crop.
  • A fixed viewport: omit fullPage and use an explicit clip or viewport-sized screenshot.

Use an element screenshot when the page is not the target

If the unwanted area is outside the component you need, do not fight page-level layout. Puppeteer’s element screenshot API captures the bounding box of a selected element.

const { chromium } = require('playwright');

The import above is not Puppeteer and should not be used for this fix. A Puppeteer example is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setViewport({ width: 1280, height: 800 });
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });

  const target = await page.waitForSelector('.content', {
    visible: true,
    timeout: 30000
  });
  await target.screenshot({ path: 'content.png' });

  await browser.close();
})();

Replace .content with a stable selector from your application. This output excludes page-level header, footer, and unrelated whitespace, but it depends on the selector continuing to identify the intended region.

Set the viewport before navigation

Viewport size changes responsive breakpoints, text wrapping, image dimensions, and therefore document height. Puppeteer recommends setting it before page.goto(); changing it afterward can leave you debugging a layout that was computed for a different size.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  await page.setViewport({ width: 1280, height: 800, deviceScaleFactor: 1 });
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });

  await page.screenshot({ path: 'full.png', fullPage: true });
  await browser.close();
})();

Choose the viewport that represents the result you need. A phone-sized viewport can activate a mobile layout, and some sites do not expect a phone-size change during a desktop session. Test the same width and height used by your production job rather than relying on the default viewport.

Measure the rendered document before changing CSS

Log the layout dimensions at the moment of capture. Comparing several height properties helps distinguish genuine document content from a single oversized box.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const metrics = await page.evaluate(() => ({
  innerWidth: window.innerWidth,
  innerHeight: window.innerHeight,
  bodyScrollHeight: document.body.scrollHeight,
  bodyOffsetHeight: document.body.offsetHeight,
  documentScrollHeight: document.documentElement.scrollHeight,
  documentClientHeight: document.documentElement.clientHeight,
  bodyRect: document.body.getBoundingClientRect().toJSON(),
  htmlRect: document.documentElement.getBoundingClientRect().toJSON()
}));
console.log(metrics);

If scrollHeight is much larger than the visible content, inspect the elements near the bottom of the document. In DevTools, temporarily outline boxes and check computed styles for:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • min-height or fixed height on wrappers, sections, and app shells;
  • large bottom margin or padding;
  • absolutely positioned or transformed elements extending beyond their parent;
  • fixed or sticky UI that is being included by your layout strategy;
  • images, fonts, or widgets that change size after the first paint;
  • viewport-relative rules such as 100vh and 100vw.

These are diagnostic paths, not a claim that one property causes every report. Remove or constrain the rule in the application stylesheet, then measure again. Avoid permanently injecting a blanket rule such as * { margin: 0 }; it can hide the actual component responsible and damage intentional spacing.

Check viewport-relative CSS carefully

Rules using 100vh, 100vw, or calculations based on them can make a section taller than the content, especially when nested inside other full-height containers. An older Puppeteer issue described vw/vh behavior associated with full-page screenshots. Treat that report as a historical clue for testing, not proof of a current universal Puppeteer defect.

Temporarily replace the suspect rule with content-based sizing to isolate it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.suspect-section {
  min-height: auto;
  height: auto;
  padding-bottom: 0;
}

If the screenshot becomes correct, restore the intended design with a narrower rule—for example, apply a minimum height only to the viewport shell, not to every nested section. Verify the result at each responsive breakpoint you support.

Wait for the layout state you actually need

Navigation completion does not guarantee that a single-page application, lazy image, font, or client-side widget has settled. Puppeteer’s guide demonstrates waitUntil: 'networkidle2', but your page may need a more specific readiness condition.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
await page.goto(url, { waitUntil: 'networkidle2' });
await page.waitForSelector('[data-app-ready="true"]', {
  timeout: 30000
});
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'full.png', fullPage: true });

Use a selector or application-ready signal that means the content is complete. For image-heavy pages, wait for the relevant images to finish loading; for an infinite list, define the number of items that must exist. A fixed delay can help with a known animation, but it is less reliable than a state-based condition.

Compare full-page, clipped, and element captures

Method Use it when Whitespace behavior Main dependency
page.screenshot({ fullPage: true }) You need the rendered document Includes layout height, including unintended space Correct CSS and settled content
page.screenshot({ clip }) You need a known rectangle Only the specified coordinates are captured Accurate, stable coordinates
elementHandle.screenshot() You need one component or region Excludes unrelated page space A stable selector and element bounds

Use clipping only when the rectangle is deliberate. Hard-coded coordinates can break when text wraps or a responsive breakpoint changes. Element capture usually communicates intent better for a component.

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.

Very tall or implausibly blank outputs

If the output is blank, clipped, or far taller than the measured document, record the page dimensions and test a smaller region. A historical issue reported blank or capped captures for unusually tall documents in one environment; it is not current compatibility guidance or a universal Chromium limit. Segmenting a long page, capturing sections separately, or using an element screenshot can isolate whether the problem is document size, a particular element, or the browser environment.

  1. Log scrollHeight, viewport dimensions, and the final image dimensions.
  2. Capture the top, middle, and bottom regions with clips or element screenshots.
  3. Reduce the page to a smaller test document and reproduce with the same Puppeteer and Chromium versions.
  4. Remove one large widget or lazy-loaded section at a time to find the contributor.

Common symptoms and fixes

Blank space only at the bottom

Inspect the last visible section and its ancestors for bottom margin, padding, min-height, or a viewport-height calculation. Confirm that an absolutely positioned child is not extending the scrollable area.

Extra space appears only at one viewport

Compare responsive CSS at that width. Set the viewport before navigation and test the breakpoint boundary, where a different wrapper or navigation layout may apply.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Space appears after fonts or images load

Capture only after the app-ready condition and relevant assets have settled. Measure immediately before the screenshot rather than after navigation alone.

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

The element screenshot is still too large

Inspect the selected element’s bounding box and its own padding, pseudo-elements, fixed height, and overflowing children. Select a narrower descendant if the outer component intentionally reserves space.

Capture is clipped or blank on a very long page

Compare dimensions, try segmented captures, and reproduce with a smaller document. Do not assume a current universal height limit from an old issue report.

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 provides a one-request website screenshot API when you do not want to maintain Puppeteer setup and timing code. It accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server lets Claude, Cursor, or another MCP client use take_screenshot, get_page_info, and capture_pdf.

Use the API documentation at https://screenshotneo.com/docs/ for all options, including full-page capture, lazy-image loading, CSS-selector element capture, viewport and device presets, retina scale, custom CSS or JavaScript, click-before-capture, selector or network-idle waits, request blocking, headers, cookies, user agents, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture, usage reporting, and PDF output.

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

cURL

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

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Sign up free to try it.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

FAQ

Does fullPage: true crop blank space automatically?

No. It requests a full-page capture; it does not define a whitespace-removal operation.

Should I use a fixed delay instead of networkidle2?

Use a state-based readiness condition when possible. A delay is a fallback for a known, measurable animation or delayed transition.

Is an old viewport-unit issue proof Puppeteer is broken?

No. Historical issue reports can reveal a useful test case, but they do not establish a current universal bug.

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.

Frequently Asked Questions

Can I remove whitespace without changing the site’s CSS?

Yes. Capture a stable element or an intentional clip rectangle; both avoid unrelated page-level layout space.

How can I prove which node creates the extra height?

Log document heights, inspect the final elements in DevTools, and temporarily outline or disable suspected wrappers one at a time.

What should I record when reporting a reproducible capture failure?

Record Puppeteer and Chromium versions, viewport dimensions, readiness condition, document heights, and the smallest page that reproduces the output.

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.

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.