Use Cloudflare Browser Run’s screenshot Quick Action from a Worker binding: validate the requested URL, call env.BROWSER.quickAction("screenshot", options), and return the image response. This approach renders the page’s HTML and JavaScript before capture, so you can produce thumbnails without running a separate browser service yourself.
Use a Worker binding for a Worker-hosted thumbnail endpoint
Cloudflare’s current documentation calls the service Browser Run; it was formerly called Browser Rendering. For a Worker that generates thumbnails, the direct path is a Browser Run binding named BROWSER. The Worker calls env.BROWSER.quickAction("screenshot", options) and returns the response.
The screenshot action accepts a URL or HTML. A URL is the natural input for a website-thumbnail endpoint. Use HTML instead when you want to render a custom preview card rather than capture an existing page. The separate REST endpoint is useful for integrations outside Workers, but it requires an API token with Browser Rendering edit permission; a binding keeps that token out of the Worker’s request code. See Cloudflare Browser Run documentation.
Configure the browser binding
Add a browser binding named BROWSER in wrangler.toml and use a Worker compatibility date of 2026-03-24 or later, which is required for quickAction(). Cloudflare’s documentation-based configuration is:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
name = "website-thumbnails"
main = "src/index.js"
compatibility_date = "2026-03-24"
[browser]
binding = "BROWSER"
For local development, this method is not supported in wrangler dev local mode. Run wrangler dev --remote, or set remote = true on the browser binding as documented by Cloudflare. A local-mode test that fails to resolve the binding does not establish that the deployed Worker configuration is wrong.
Build a small endpoint with URL validation
Because the endpoint accepts a URL from its caller, reject malformed URLs and unsupported schemes before asking the browser to open them. The example below only accepts HTTP and HTTPS URLs, returns a 400 for invalid input, and passes the Quick Action response through to the caller. It uses a fixed viewport suitable for a thumbnail and asks for a rendered page before capture.
export default {
async fetch(request, env) {
const requestUrl = new URL(request.url);
const target = requestUrl.searchParams.get("url");
if (!target) {
return new Response("Missing required url parameter", { status: 400 });
}
let parsed;
try {
parsed = new URL(target);
} catch {
return new Response("Invalid URL", { status: 400 });
}
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
return new Response("Only http and https URLs are supported", { status: 400 });
}
try {
const result = await env.BROWSER.quickAction("screenshot", {
url: parsed.href,
viewport: { width: 1200, height: 630 },
gotoOptions: { waitUntil: "networkidle2" },
screenshotOptions: { type: "jpeg", quality: 82 }
});
return result;
} catch (error) {
return new Response("Screenshot capture failed", { status: 502 });
}
}
};
This is a minimal endpoint, not a complete public-service security policy. If it will be exposed to untrusted callers, add access control and request-rate controls appropriate to your application, and consider which destinations it should be allowed to fetch. Do not treat a caller-supplied URL as trusted input.
Rank #2
- Intuitive interface of a conventional FTP client
- Easy and Reliable FTP Site Maintenance.
- FTP Automation and Synchronization
Choose framing and output intentionally
The browser viewport defines the visible browser window. A 1200 by 630 viewport gives a landscape preview, while a different width and height may suit a card or dashboard. Cloudflare documents a default viewport of 1920 by 1080 and a default device scale factor of 1; specify dimensions rather than relying on defaults when consistent thumbnail framing matters.
Recommended Free Tools
- Viewport capture: captures what fits in the browser window and is the usual choice for a thumbnail.
- Full-page capture: use
screenshotOptions.fullPagewhen the thumbnail should represent the full document rather than its opening viewport. - Clipped capture: use the documented
clipoption to capture a rectangle. - Element capture: use the documented selector option when the desired preview is a particular page element.
Check the Quick Action output type expected by your caller before choosing encoding options. Quality is incompatible with PNG; choose a supported lossy format such as JPEG if you need to set quality. At device scale factor 1, a large viewport can appear soft when displayed at higher resolution; increasing deviceScaleFactor can improve pixel density, at the cost of a larger image.
Wait for the page content you actually need
A page-load event can happen before a JavaScript-heavy application or single-page application has painted useful content. Cloudflare documents gotoOptions.waitUntil values networkidle0 and networkidle2 for waiting until network activity settles. These are convenient when the page’s readiness condition is unknown, but some sites keep network connections open or poll continuously.
Rank #3
When the thumbnail depends on a known component, a selector-based waitForSelector is a more targeted readiness signal and can be faster than waiting for all network activity to stop. Select a stable, visible element that indicates the content is ready. Avoid a selector that only appears after a user interaction your capture never performs.
Binding or REST, URL or HTML
| Choice | Use it when | Trade-off |
|---|---|---|
| Worker binding | The capture is part of a Cloudflare Worker request. | Calls env.BROWSER.quickAction() directly; requires the binding and compatibility date, and remote mode for local development. |
| REST screenshot endpoint | An external service or script needs to request a capture. | Uses POST https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/screenshot and requires an API token with Browser Rendering edit permission. |
| URL input | You want to capture an existing website. | The browser must load and render that destination before taking the image. |
| HTML input | You want to render a custom preview, rather than reproduce a live page. | You supply the content to be rendered instead of relying on the target site’s current page. |
Cloudflare’s API reference also describes a related snapshot endpoint that can return HTML and a screenshot together, with viewport, full-page, clipping, waiting, and output-format controls. For a thumbnail-only endpoint, the screenshot Quick Action is the narrower fit; snapshot is relevant when the application also needs extracted page content. See the screenshot API reference.
Usage limits, latency, and reliability
Cloudflare’s limits documentation, checked October 3, 2026, lists these Browser Run limits. They are service allowances and rate limits, not throughput benchmarks or guarantees:
Rank #4
| Plan | Browser Run limit listed by Cloudflare |
|---|---|
| Free | 10 minutes of Browser Run usage per day; one Quick Actions request every 10 seconds. |
| Workers Paid | 30 Quick Actions requests per second by default; no browser-hours cap. |
Cloudflare documents a 60-second default browser timeout. A slow destination can therefore fail even when the Worker code is valid. Check the current Browser Run limits and pricing before estimating production capacity, because service limits and pricing can change.
Handle failures as normal outcomes: return a controlled error instead of leaking internal exception details, and have callers retry selectively rather than retrying every failed request immediately. Retries can add browser time and encounter rate limits; an exponential backoff and a bounded retry count are safer than a tight loop.
Troubleshooting common failures
env.BROWSERis unavailable: confirm the binding name is exactlyBROWSERand configured for the Worker. For local testing, switch towrangler dev --remoteor useremote = trueon the browser binding.quickAction()is not available: set the Worker compatibility date to2026-03-24or later.- The screenshot is blank or missing app content: the page may still be rendering client-side content after the default navigation event. Try
networkidle0,networkidle2, or a selector that marks the specific content as ready. - The capture times out: the target may load slowly or never reach the chosen readiness condition. Use a more targeted selector when appropriate, and account for Cloudflare’s documented 60-second default timeout.
- The endpoint returns HTTP 429: Cloudflare documents 429 responses for rate or browser-time limits. Reduce request rate, stay within the applicable plan allowance, and check the current limits page.
- The image looks soft: increase
deviceScaleFactorwhen you need more pixel density, and verify that the returned image dimensions fit how the thumbnail will be displayed. - Quality settings are rejected: do not combine
qualitywith PNG; use JPEG or another supported format that accepts quality. - A bot-protected site refuses the capture: changing the user agent is not a bypass. Cloudflare says Browser Run requests remain identifiable as bots; do not use user-agent customization to imply otherwise or to evade a destination’s controls.
Or skip the browser setup
ScreenshotNeo is a screenshot API with a one-request URL flow. Its documented positioning is useful when you do not want to configure a browser binding: cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed; and an MCP server provides screenshot tools for AI agents. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. See the ScreenshotNeo API documentation.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutecurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month without a card.
Best Value
Frequently Asked Questions
Can a Cloudflare Worker capture a full page instead of the visible viewport?
Yes. The screenshot Quick Action documents screenshotOptions.fullPage for full-page capture; use it when the image should represent the full document rather than the viewport.
Does changing the browser user agent get around a website’s bot protection?
No. Cloudflare says Browser Run requests remain identifiable as bots, so a user-agent override should not be treated as a way to bypass a destination’s access controls.
Quick Recap
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.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →




