October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Capture Screenshots for URLs in a Text File with Chrome Headless

Read URLs line by line and run Chrome headless once per URL, saving each PNG under a distinct filename.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put one URL on each line of a text file, then run Chrome headless once per nonblank line with a unique screenshot path. Chrome’s --screenshot option writes a PNG; --window-size sets the viewport. The loop below is for a Unix-like shell and saves each capture separately.

Capture a list of URLs with Chrome headless

First, create a text file named urls.txt with one URL per line:

As an Amazon Associate I earn from qualifying purchases.

https://example.com/
https://developer.chrome.com/
https://www.wikipedia.org/

Create an output directory, then run this shell loop from the directory containing urls.txt:

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

n=0
while IFS= read -r url || [ -n "$url" ]; do
  [ -z "$url" ] && continue
  n=$((n + 1))
  chrome --headless --screenshot="screenshots/page-$n.png" 
    --window-size=1280,900 --timeout=10000 "$url"
done < urls.txt

The loop skips empty lines, numbers the output files, and handles a final line without a trailing newline. The URL is quoted so shell characters in it are not treated as shell syntax. Chrome’s documented basic screenshot command is chrome --headless --screenshot --window-size=412,892 https://developer.chrome.com/; by default it writes screenshot.png in the current working directory. See the Chrome Headless command-line reference.

#1 Best Overall
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

Check the Chrome command on your system

The executable may be named chrome, google-chrome, or have a platform-specific path. If the shell reports that the command cannot be found, replace chrome in the loop with the installed executable name or full path. Test with one or two URLs first.

Use distinct output filenames

Without a path after --screenshot, Chrome uses the same default filename, screenshot.png, for each invocation. In a batch, a later capture can overwrite an earlier one. The counter in this example creates files such as screenshots/page-1.png and screenshots/page-2.png. To use URL-derived names instead, first turn the hostname or path into a filename-safe string; raw URLs can contain slashes and other characters unsuitable for filenames.

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

Choose viewport and wait behavior

Viewport size is not full-page capture

--window-size=WIDTH,HEIGHT sets the viewport dimensions for the capture. For example, --window-size=1280,900 requests a 1280-by-900 viewport. Do not assume this basic --screenshot command captures the entire document: the cited command-line reference does not document a dedicated full-page option for it.

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

Timeout is a limit, not a readiness signal

--timeout takes milliseconds and sets the maximum wait before capture, including when a page is still loading. The example uses 10,000 milliseconds. A timeout does not prove that the page finished rendering or that lazy-loaded images and other deferred content are visible. Chrome also documents --virtual-time-budget, which can fast-forward time-dependent page code; whether that produces the desired result depends on the page.

Rank #3
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.

Adapt the loop to your shell and site

Windows and other shells

The loop shown above uses Unix-like shell syntax. On Windows, use PowerShell or another shell’s own line-reading loop, and quote both the Chrome executable path and each URL according to that shell’s rules. The essential pattern is the same: read a line, ignore blanks, invoke Chrome with that URL, and provide a distinct output path for every invocation.

Expect site-specific behavior

Chrome’s options do not guarantee that every URL will produce the expected image. A site may redirect, require authentication, block automated traffic, or render differently in a headless session. Check a sample output before processing a long file, especially if your URLs depend on sign-in or dynamic content.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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

Troubleshoot common problems

  • No screenshot appears: Confirm the executable name or path, that the output directory exists, and that the URL is valid. Run Chrome against one URL directly to separate browser or shell problems from loop problems.
  • Every run leaves only one image: Give each invocation a unique value for --screenshot; the default screenshot.png is reused.
  • The image is clipped: The command captures the chosen viewport, not a guaranteed full-page image. Adjust --window-size if a larger viewport is suitable, or use a different browser automation approach if you need document-length capture.
  • The page looks incomplete: Increase --timeout to allow more time, but treat it only as a maximum wait. For time-dependent page code, try the documented virtual-time budget option; neither setting guarantees that every page-specific condition has been met.
  • A URL or path breaks the command: Keep the URL quoted as in the example. Do not use an unsanitized raw URL as a filename.
  • The page redirects, blocks the browser, or asks for a login: Check the site’s access requirements and whether the target is available in a headless session. The command-line options do not bypass authentication or guarantee access.

Or skip the browser setup

For a repeatable screenshot request without managing a local Chrome loop, ScreenshotNeo offers a website screenshot API and an MCP server. Its API accepts one GET request for a URL and can return a PNG, JPEG, WebP, or PDF. For an individual capture, use this cURL example, replacing the URL with your target:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for API parameters. ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Every feature is available on every plan. Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month, with no card.

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

Frequently Asked Questions

Does the Chrome headless command save a PNG or a PDF?

The --screenshot command described here saves a PNG. The screenshot command-line reference does not establish PDF output for this method.

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.

Can I capture several URLs in parallel with this loop?

No. The sample invokes Chrome sequentially, once for each nonblank line. It makes no performance claim; parallel execution would require changing the workflow and managing separate processes and output paths.

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.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.