DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

How to Capture a Full Webpage in Chrome from the Command Line

Chrome’s basic headless screenshot captures requested dimensions, not necessarily the full document. Learn when to use CDP beyond-viewport capture or Chrome’s PDF option.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a basic headless screenshot, run Chrome with --headless --screenshot. That captures the requested browser dimensions, not necessarily the entire page. To capture content beyond the viewport as an image, use a Chrome DevTools Protocol (CDP) client and set captureBeyondViewport: true on Page.captureScreenshot. If a document is acceptable instead of an image, Chrome’s --print-to-pdf option is simpler.

Choose the output you need

Need Command-line method What it produces
A quick screenshot at chosen dimensions --headless --screenshot --window-size=... An image at the requested dimensions; not a guaranteed capture of the whole document.
An image extending beyond the viewport CDP Page.captureScreenshot with captureBeyondViewport: true Base64-encoded image data that your client must decode and save.
A printable page --headless --print-to-pdf A PDF, not an image.

Chrome’s Headless CLI documentation documents the screenshot and PDF flags. The CDP protocol reference describes beyond-viewport capture. Chrome and CDP behavior can vary by version, so check the documentation against the Chrome release installed on your machine.

As an Amazon Associate I earn from qualifying purchases.

Capture a basic headless screenshot

Run this in a terminal where the Chrome executable is available:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chrome --headless --screenshot --window-size=1280,900 https://example.com/

Chrome saves screenshot.png in the current working directory. The --window-size values request the screenshot dimensions. This is useful for a viewport-sized image, but the documented command does not promise that the image includes every part of a long page. Increasing the requested height is not a reliable substitute for a full-document capture.

#1 Best Overall
Samsung 14" Galaxy Chromebook Go Laptop PC Computer, Intel Celeron N4500 Processor, 4GB RAM, 64GB Storage, ChromeOS, XE340XDA-KA2US, Student Laptop, Silver
  • SLIM. LIGHTWEIGHT. READY TO GO: The all-new slim design is perfect for busy lives on the go.
  • SKILLFULLY DESIGNED. MILITARY TOUGH: Built with premium craftsmanship to withstand the occasional drop or ding.
  • ALL-DAY, ALL-IN-ONE CHARGING: Power through your school day – and beyond – with a long-lasting 12-hour battery.¹
  • 3X FASTER THAN THE PREVIOUS GENERATION OF WIFI: Crush your schoolwork in record time with Wi-Fi that’s three times faster than the previous generation of Wi-Fi.
  • YOUR PHONE AND CHROMEBOOK WORK BETTER TOGETHER: Easily transfer files between devices, and control your phone right from your Chromebook.

Set a wait cap when needed

You can add --timeout=<milliseconds> to limit how long Chrome waits before taking a screenshot or printing to PDF:

chrome --headless --timeout=5000 --screenshot --window-size=1280,900 https://example.com/

The timeout is a maximum wait, not confirmation that a dynamic page has finished loading. Pages that populate content after network activity settles may still be incomplete when the capture occurs.

Capture beyond the viewport with CDP

For a full-page image, the relevant Chrome DevTools Protocol method is Page.captureScreenshot. Set its captureBeyondViewport option to true, then decode the response’s base64 data value and write the decoded bytes to an image file. The protocol supports PNG, JPEG, and WebP formats.

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
HP Chromebook 14 Laptop, Intel Celeron N4120, 4 GB RAM, 64 GB eMMC, 14" HD Display, Chrome OS, Thin Design, 4K Graphics, Long Battery Life, Ash Gray Keyboard (14a-na0226nr, 2022, Mineral Silver)
  • FOR HOME, WORK, & SCHOOL – With an Intel processor, 14-inch display, custom-tuned stereo speakers, and long battery life, this Chromebook laptop lets you knock out any assignment or binge-watch your favorite shows..Voltage:5.0 volts
  • HD DISPLAY, PORTABLE DESIGN – See every bit of detail on this micro-edge, anti-glare, 14-inch HD (1366 x 768) display (1); easily take this thin and lightweight laptop PC from room to room, on trips, or in a backpack.
  • ALL-DAY PERFORMANCE – Reliably tackle all your assignments at once with the quad-core, Intel Celeron N4120—the perfect processor for performance, power consumption, and value (2).
  • 4K READY – Smoothly stream 4K content and play your favorite next-gen games with Intel UHD Graphics 600 (3) (4).
  • MEMORY AND STORAGE – Enjoy a boost to your system’s performance with 4 GB of RAM while saving more of your favorite memories with 64 GB of reliable flash-based eMMC storage (5).

This is not a single documented Chrome command-line flag. You need a CDP-capable client or script to connect to Chrome, issue the protocol command, receive its response, and save the image. The exact runnable syntax depends on that client; verify its connection and command syntax against the client documentation and the CDP protocol version supported by your installed Chrome.

  1. Start Chrome in headless mode with remote debugging enabled, following the connection instructions for your CDP client.
  2. Open the target page through that client and wait for the content you need to appear.
  3. Send Page.captureScreenshot with captureBeyondViewport: true; select PNG, JPEG, or WebP if your client exposes the format option.
  4. Decode the returned base64 image data and save the bytes with the matching file extension.

Because the official protocol reference defines the capture option but not a universal shell-client syntax, do not paste a command written for one CDP client into another without adapting its connection, command, and base64-decoding steps.

Save the page as a PDF instead

If you need a printable document rather than an image, use Chrome’s headless print option:

chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com/

This writes a PDF. The --no-pdf-header-footer flag suppresses the printed header and footer. You can also use --timeout=<milliseconds> as a wait cap, with the same caveat that elapsed time does not establish that dynamic content has loaded.

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

Troubleshoot common capture problems

  • The image shows only the top portion of the page: the basic --screenshot command captures requested dimensions, not a guaranteed full document. Use a CDP client and captureBeyondViewport: true for an image extending beyond the viewport.
  • No screenshot appears: Chrome saves screenshot.png in the current working directory. Check that directory and confirm the command ran with a Chrome executable available in your shell.
  • The page is missing content that appears later: the timeout flag only caps the wait. Increase the wait or use an automation client that can wait for the relevant page state before capture.
  • The CDP call returns data but no usable file: the screenshot response contains base64 data. Decode it to binary before writing the file, and use an extension that matches the requested image format.
  • You need a document rather than a very tall image: use --print-to-pdf; it creates a PDF, which is a different output format from a screenshot.
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 screenshot API and MCP server. One GET request can return a screenshot or PDF; its cookie-cleanup steps accept consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture, and each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with response headers indicating the page verdict and whether the request was billed. Its MCP server offers screenshot tools for AI agents, and its API supports full-page capture.

For example, this cURL request saves a screenshot of the target page:

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

See the ScreenshotNeo API documentation for authentication and request options. The API also accepts parameter names used by other screenshot APIs, which can make switching easier. Plans include 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000. Try ScreenshotNeo by signing up for 1,000 free screenshots a month, with no card required.

Rank #4
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.

Frequently Asked Questions

Does Chrome have a documented full-page screenshot flag?

The documented --screenshot option is paired with --window-size; beyond-viewport capture is exposed through CDP’s captureBeyondViewport option.

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

Can Chrome save the capture as a PDF from the command line?

Yes. Use --headless --print-to-pdf; it creates a PDF rather than an image.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.