Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
In JavaScript, a screenshot can come from either a browser automation library you run—such as Playwright or Puppeteer—or a hosted screenshot API you call over HTTP. Use a library when you need to manage the browser and its page state yourself; use a hosted service when you want to send a URL to an endpoint and receive a capture. The code and constraints differ, so check the chosen library or provider’s current documentation before shipping.
Choose between browser automation and a hosted API
Playwright and Puppeteer expose screenshot methods on a browser page. Your application launches or connects to a browser, navigates to the target URL, and captures the rendered page. A hosted service instead handles the browser work and exposes an HTTP endpoint your JavaScript calls. These are different implementation patterns, not interchangeable APIs.
- Use Playwright or Puppeteer when your code should control browser navigation and capture directly.
- Use a hosted API when you want to delegate capture to a service and integrate through its documented HTTP request and response format.
Take a screenshot with Playwright
After navigating to the page, await page.screenshot(). This basic example writes a PNG to a file:
await page.screenshot({ path: 'screenshot.png' });
A typical flow is to launch a browser, create a page, navigate, capture, and close the browser. The exact setup depends on how your application installs and connects to Playwright.
#1 Best Overall
Capture bytes instead of writing a file
Playwright’s screenshot method can also return image bytes for further processing. Consult the Playwright Page API for the current return type and options. The Playwright screenshots guide documents page and element screenshots, as well as options such as output scale and masking.
Take a screenshot with Puppeteer
The equivalent Puppeteer method is also asynchronous. Navigate to the page first, then await the screenshot:
Rank #2
await page.screenshot({ path: 'screenshot.png' });
Puppeteer documents that Page.screenshot() returns a Promise<Uint8Array> by default; setting encoding: 'base64' returns a base64 string instead. See the Page.screenshot() API reference for its signature and the Puppeteer screenshots guide for the browser workflow.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesWait for the page state your capture needs
A page can finish its initial navigation before the content you care about has rendered. Puppeteer’s guide shows waitUntil: 'networkidle2' as one navigation option, but that is an example, not a universal wait strategy. Choose a page-state condition that fits the site and capture; for example, a dynamic page may require waiting for a particular element. Close the browser in a cleanup path so it is not left running after success or failure.
Choose the screenshot scope and output options
Both libraries offer ways to control what is captured, but option names and behavior differ. Verify details against the relevant API documentation rather than assuming a setting works the same across libraries.
| Need | What to check |
|---|---|
| Visible viewport or full page | Whether the screenshot covers the current viewport or the full scrollable page. |
| One element or a region | Element screenshot support or a clipping rectangle. |
| Image format and quality | Supported formats, any quality setting, and how the library selects the output type. |
| Scaling or transparency | Output scale and whether a transparent background is available for the chosen format. |
| Post-processing | Whether the method returns bytes, a base64 string, or writes to a path, and how that result fits the next step. |
Puppeteer documents full-page capture, clipping, file paths, image type, optional quality, and transparent-background behavior in its ScreenshotOptions reference. Its default type is PNG; a path extension can determine the output type. Playwright’s API documentation describes its own supported options and return values.
Rank #4
Call a hosted screenshot API from JavaScript
A hosted screenshot service typically accepts a target URL and authentication according to its own API contract. One vendor-specific example is SnapshotFlow, whose JavaScript page describes calling its endpoint with fetch or XMLHttpRequest and an API key in an X-Api-Key header. That example does not establish the endpoint, header, response format, browser compatibility, CORS policy, quotas, or guarantees for another provider. SnapshotFlow’s page was listed as updated July 31, 2026; its claims are the vendor’s, not independently verified here. Check the service’s current documentation before relying on its instructions.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Keep credentials out of public browser code
An API key embedded in a JavaScript bundle delivered to visitors may be exposed. Before making a request from a browser, verify the provider’s supported authentication and server-side proxy guidance. Do not assume that a vendor’s example makes a public client safe or that its endpoint permits cross-origin requests.
Best Value
Or skip the browser setup:
ScreenshotNeo provides a hosted screenshot API. Send a GET request with a URL to receive a PNG, JPEG, WebP, or PDF. Its capture workflow accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
For setup details and supported parameters, see the ScreenshotNeo API documentation. This Node.js example saves the response body as a WebP file:
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 response body can be written to a file with your preferred Node.js file-handling code. ScreenshotNeo also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free and try 1,000 screenshots a month without a card.
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 minuteQuick 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.

