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
World desk6 min

How to Screenshot Multiple Website URLs Concurrently in Go

Use chromedp with independent page contexts and a bounded worker pool to screenshot multiple URLs in Go without launching an unbounded number of browser tasks.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use chromedp with a bounded worker pool: give each screenshot job its own browser target/context, capture the page, and write the resulting bytes to a URL-specific output. Keep the worker limit configurable; there is no documented universal maximum number of tabs or optimal concurrency setting.

Build a bounded concurrent screenshot runner

The example below uses one Chrome process and creates a separate chromedp context for each URL job. Each worker navigates and captures independently, so concurrent tasks do not race to change the same tab. The worker limit is configurable through a command-line argument.

As an Amazon Associate I earn from qualifying purchases.

Install chromedp with go get github.com/chromedp/chromedp. Chrome or Chromium must also be available in the environment. Save this as main.go:

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.
package main

import (
	"context"
	"fmt"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"sync"
	"time"

	"github.com/chromedp/chromedp"
)

type result struct {
	url  string
	path string
	err  error
}

func main() {
	workers := 3 // Start conservatively, then tune for your workload.
	if len(os.Args) > 1 {
		n, err := strconv.Atoi(os.Args[1])
		if err != nil || n < 1 {
			fmt.Fprintln(os.Stderr, "usage: go run . [positive-worker-count]")
			os.Exit(2)
		}
		workers = n
	}

	urls := []string{
		"https://example.com",
		"https://go.dev",
		"https://chromium.org",
	}

	if err := os.MkdirAll("screenshots", 0755); err != nil {
		fmt.Fprintln(os.Stderr, "create output directory:", err)
		os.Exit(1)
	}

	// Create one browser allocator for this batch. Each job below gets its
	// own chromedp context/target while sharing the allocator's browser setup.
	allocCtx, cancelAlloc := chromedp.NewExecAllocator(context.Background(),
		chromedp.DefaultExecAllocatorOptions[:]...,
	)
	defer cancelAlloc()

	jobs := make(chan string)
	results := make(chan result, len(urls))
	var wg sync.WaitGroup

	for i := 0; i < workers; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			for url := range jobs {
				results <- capture(allocCtx, url)
			}
		}()
	}

	go func() {
		for _, url := range urls {
			jobs <- url
		}
		close(jobs)
		wg.Wait()
		close(results)
	}()

	failed := false
	for r := range results {
		if r.err != nil {
			failed = true
			fmt.Fprintf(os.Stderr, "FAILED %s: %vn", r.url, r.err)
			continue
		}
		fmt.Printf("SAVED %s -> %sn", r.url, r.path)
	}
	if failed {
		os.Exit(1)
	}
}

func capture(parent context.Context, url string) result {
	// The timeout applies to this URL only; a slow page does not block the
	// rest of the batch indefinitely.
	ctx, cancel := context.WithTimeout(parent, 60*time.Second)
	defer cancel()

	tabCtx, cancelTab := chromedp.NewContext(ctx)
	defer cancelTab()

	var image []byte
	err := chromedp.Run(tabCtx,
		chromedp.Navigate(url),
		chromedp.FullScreenshot(&image, 90),
	)
	if err != nil {
		return result{url: url, err: err}
	}

	name := safeName(url) + ".jpg"
	path := filepath.Join("screenshots", name)
	if err := os.WriteFile(path, image, 0644); err != nil {
		return result{url: url, err: err}
	}
	return result{url: url, path: path}
}

func safeName(url string) string {
	s := strings.TrimPrefix(url, "https://")
	s = strings.TrimPrefix(s, "http://")
	s = strings.NewReplacer("/", "_", ":", "_", "?", "_", "&", "_").Replace(s)
	return s
}

Run it with go run ., or set a different limit, for example go run . 5. The example uses FullScreenshot with quality 90, which produces JPEG bytes. Its 60-second per-job deadline is a starting policy in this example, not a chromedp-recommended timeout.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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

Choose the right screenshot operation

  • chromedp.CaptureScreenshot captures the current viewport. Use it when only the visible screen is needed.
  • chromedp.FullScreenshot captures the whole page. In the package documentation, quality 100 selects PNG; other quality values select JPEG. The official example notes that this operation overrides device emulation settings.
  • chromedp.Screenshot captures a selected page element. Use it to isolate a component rather than the full document.

Navigation waits for the page to load, but this does not mean every site’s asynchronous content is finished rendering. For pages that hydrate, load images lazily, or fetch data after navigation, wait for an application-specific selector or readiness condition before capturing.

Set concurrency by measuring your workload

A bounded pool avoids creating an unbounded number of goroutines and browser tasks when the input list is large. The sample starts at three workers as a conservative configurable example—not as a documented optimum. The chromedp references do not specify a maximum safe tab count, throughput, or ideal worker count.

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

Benchmark with the actual sites and machine. Increase the limit gradually while tracking completion time, memory and CPU use, Chrome stability, and per-URL failures. Pages with heavy scripts, large images, or slow third-party resources may behave very differently from simple static pages.

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

Choose the browser lifecycle according to what the workload needs. Independent targets provide separation between jobs; sharing a browser setup avoids making every worker independently launch its own browser. If the jobs require a shared login/session or tightly controlled device emulation, plan that state explicitly rather than assuming separate contexts share it.

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.

Handle failures and output safely

  • Keep errors attached to URLs. The example reports each failure and continues the remaining jobs, then exits nonzero if any failed. For an all-or-nothing batch, collect results first and only publish output after every URL succeeds.
  • Use unique output names. The sample derives a filename from the URL, but distinct URLs can normalize to the same filename. For arbitrary inputs, use a stable index or hash alongside the URL and retain a manifest mapping outputs back to source URLs.
  • Apply deadlines and cancellation. A job-level deadline prevents one slow navigation from holding a worker forever. Choose the duration based on the target pages; the documentation does not prescribe a universal timeout.
  • Clean up contexts and the browser. Cancel each task context and the allocator when the batch ends. chromedp documents that browser connection loss cancels its context; treat cancellation as potentially caused by Chrome closing or terminating, not necessarily by a bad URL.
  • Be mindful of output format. Name files with the format returned by the selected capture action. Do not write PNG bytes to a .jpg path or assume a viewport screenshot and a full-page screenshot behave identically.

Common errors and fixes

  • ErrInvalidContext: chromedp actions such as Run, Do, and Call require a context created by chromedp.NewContext. Build the task context from the allocator context as in the sample.
  • Context canceled or browser connection lost: Chrome may have exited, crashed, or lost its connection. Check browser availability and process/resource limits, reduce concurrency, and retry only the affected URL according to your batch policy.
  • Capture occurs before dynamic content appears: navigation’s load completion is not a guarantee that asynchronous application work is finished. Add a wait for a known selector or another site-specific readiness signal.
  • Some screenshots overwrite others: ensure output names are unique for the actual URL set; a sanitized URL alone can collide.
  • Full-page output ignores emulation settings: account for the documented behavior of FullScreenshot; choose a viewport capture or a different capture strategy if preserving device emulation is essential.
  • Large batches stall or destabilize Chrome: avoid one goroutine per URL without a limit. Lower the worker count and test progressively; there is no source-backed universal tab ceiling.

Alternative browser model

If your project already uses Playwright-compatible tooling, Playwright documents browser contexts that can contain multiple pages, with each page representing a tab or popup. That is a different API and context model from chromedp; the reviewed documentation does not establish a performance or scalability winner between them.

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

Or skip the browser setup

For a single GET request per URL, ScreenshotNeo returns a screenshot or PDF without you provisioning Chrome. For example, using curl:

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
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 docs for request options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. For a concurrent batch, call the endpoint for each URL with your own bounded Go worker pool.

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

Sign up for 1,000 free screenshots a month, with no card required.

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.