Free tools Windows power users keep installed
One-click scans. No signup required.
Use Puppeteer’s default screenshot output and wrap its bytes with Node.js: const screenshotBuffer = Buffer.from(await page.screenshot()); Puppeteer documents the default result as a Uint8Array; Buffer.from() converts it to a Node.js Buffer. You do not need a file path to get the bytes.
Return screenshot bytes as a Buffer
Here is a complete ES module example. It navigates to a page, captures the default PNG screenshot in memory, converts the returned bytes to a Buffer, and closes the browser even if navigation or capture fails.
As an Amazon Associate I earn from qualifying purchases.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
const screenshotBuffer = Buffer.from(await page.screenshot());
// Pass screenshotBuffer to another function or API.
console.log(Buffer.isBuffer(screenshotBuffer)); // true
} finally {
await browser.close();
}
In CommonJS, replace the import with const puppeteer = require('puppeteer');. The capture and conversion line stays the same. The Puppeteer 25.12.0 API documents the default screenshot result as Promise<Uint8Array>; the resulting Buffer is created by Node.js.
Recommended Free Tools
Why the default result is not already a Buffer
page.screenshot() resolves to binary image bytes represented as a Uint8Array by default. Node.js Buffers are a byte-oriented subclass of Uint8Array, but if your receiving code specifically expects a Buffer, explicitly use Buffer.from(await page.screenshot()).
#1 Best Overall
Do not set encoding: 'base64' for this path. That option changes the result to a base64 string, not binary bytes. If you specifically need base64 text, convert it back with Buffer.from(base64, 'base64'); otherwise, keep the default binary result.
Save the screenshot to a file as well
Use path when you want Puppeteer to write an image file. It is not required for an in-memory Buffer.
Rank #2
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
const screenshotBuffer = Buffer.from(
await page.screenshot({ path: 'screenshot.png' })
);
} finally {
await browser.close();
}
The Puppeteer screenshot guide demonstrates saving with path. If you only need bytes for an upload or further processing, omit it.
Choose the capture options you need
The examples above use the defaults: PNG output, a viewport screenshot, and the regular page background. Puppeteer 25.12.0 documents the following relevant options and behaviors in its screenshot options API.
Rank #3
- Capture the full page: pass
{ fullPage: true }. Without a clip,fullPagedefaults to false. - Capture a region: pass a
cliprectangle to screenshot a specified area. The full-page default applies when there is no clip. - Select an image type: set
typeto'png','jpeg', or'webp'. PNG is the default. - Set lossy-image quality: use
qualityfor JPEG or WebP output; quality does not apply to PNG. - Make the background transparent: pass
{ omitBackground: true }where the selected format supports transparency. - Return base64 text: set
encoding: 'base64'; this returns a string, which you can decode withBuffer.from(value, 'base64')if a Buffer is needed. - Capture an element: call
elementHandle.screenshot(). Puppeteer scrolls the element into view when needed; its default return is also aUint8Array, so wrap it withBuffer.from().
Example: full-page WebP Buffer
const screenshotBuffer = Buffer.from(
await page.screenshot({ fullPage: true, type: 'webp', quality: 80 })
);
Example: element screenshot Buffer
const element = await page.$('.report');
if (!element) throw new Error('Could not find .report');
const screenshotBuffer = Buffer.from(await element.screenshot());
Common problems and fixes
- You received a string instead of bytes: check for
encoding: 'base64'. Remove it for the default binary output, or decode the string withBuffer.from(value, 'base64'). - Your upload library rejects the value: verify that the screenshot was converted with
Buffer.from(await page.screenshot())and that you are passing the Buffer itself, not a base64 string or a path. - You expected a file to appear: an in-memory capture does not write one. Add
path: 'screenshot.png'to the screenshot options when file output is also wanted. - The image is only the visible viewport: set
fullPage: trueto capture the full page rather than the default viewport area. - The page or element is missing from the image: confirm navigation completed and, for element captures, check that the selector matched before calling
screenshot().
Or skip the browser setup
If you need a screenshot returned by an API rather than captured in your own Puppeteer process, ScreenshotNeo returns an image or PDF from one GET request. See the API documentation for options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server gives AI agents screenshot and PDF capture tools. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up free for 1,000 screenshots a month—no card required.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsRank #4
Frequently Asked Questions
Does Puppeteer return a Buffer from page.screenshot()?
No. In Puppeteer 25.12.0 the documented default result is a Uint8Array; use Buffer.from() when your code needs a Node.js Buffer.
Do I need the path option to get screenshot bytes?
No. Omit path for an in-memory result. Add path only when you also want Puppeteer to save the image to a file.
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.




