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

Use Puppeteer’s page.screenshot() method and give it a filename with the format extension you want, such as capture.png, capture.jpg, or capture.webp. To choose the format explicitly, set type to 'png', 'jpeg', or 'webp'. PNG is the documented default. The examples below follow the Puppeteer documentation labeled version 25.12.0, accessed October 3, 2026; check the current API reference if you use another version.

Save a page screenshot to a file

Install Puppeteer in your project if it is not already installed, then run this ES module. Puppeteer’s official guide uses Page.screenshot() to capture a page, and the path option saves the resulting image to disk.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'capture.png' });
} finally {
  await browser.close();
}

Run the file in a Node.js environment that supports ES modules. Replace the target URL with the page you want to capture. A relative output path, such as capture.png, is resolved from the process’s current working directory. See the Puppeteer Screenshots guide and the ScreenshotOptions API reference for the current documented behavior.

Choose PNG, JPEG, or WebP

Puppeteer can infer the image format from the filename extension. You can also set type to make the format explicit. Use a matching extension and type so the filename describes the actual image format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
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
Format Example Quality option Useful detail
PNG await page.screenshot({ path: 'page.png' }); Not applicable PNG is the documented default format.
JPEG await page.screenshot({ path: 'page.jpg', type: 'jpeg', quality: 85 }); Documented range: 0–100 The example value is not a universal recommendation; assess the result for your page and use.
WebP await page.screenshot({ path: 'page.webp', type: 'webp', quality: 85 }); Documented range: 0–100 WebP is included in Puppeteer’s documented image-format type.

The Puppeteer options reference documents a numeric quality range from 0 through 100 for applicable non-PNG formats; it does not prescribe one best setting. The documentation does not establish a universal file-size or image-quality ranking among these formats, so choose based on what your next tool accepts and inspect output for the page in question.

Set the format explicitly

If you prefer not to rely on extension-based inference, set both path and type. Puppeteer uses 'jpeg' for JPEG even when the filename ends in .jpg.

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
await page.screenshot({ path: 'page.png', type: 'png' });
await page.screenshot({ path: 'page.jpeg', type: 'jpeg', quality: 85 });
await page.screenshot({ path: 'page.webp', type: 'webp', quality: 85 });

Do not pass quality expecting it to affect a PNG screenshot; that option does not apply to PNG.

Use screenshot bytes without saving a file

When you omit path, page.screenshot() returns image data in memory instead of writing a file. Its default return value is a Uint8Array. Set encoding: 'base64' when you specifically need a base64 string.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
const bytes = await page.screenshot();
const base64 = await page.screenshot({ encoding: 'base64' });

The screenshot call is asynchronous, so await it before writing the bytes, sending them elsewhere, or processing them. The return type and encoding options are documented in the Page.screenshot API reference.

Capture one element instead of the whole page

For a single element, locate it and call its screenshot method. Puppeteer scrolls the element into view if needed. The method throws if the element handle has been detached from the DOM before capture.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
const card = await page.waitForSelector('.product-card');
if (!card) {
  throw new Error('Product card was not found');
}
await card.screenshot({ path: 'product-card.webp', type: 'webp' });

See the Puppeteer Screenshots guide for page and element capture examples.

Troubleshoot common problems

  • The file is not where expected: A relative path is resolved from the current working directory, which may differ from the folder containing your script. Use an absolute path or check the process working directory.
  • The image has an unexpected format: Align the filename extension and type. For instance, use path: 'capture.webp' with type: 'webp'.
  • PNG output does not change when quality changes: The documented quality option does not apply to PNG. Use JPEG or WebP if you need to set that option.
  • No file appears: Confirm that you supplied a path. Without one, the screenshot is returned in memory rather than saved to disk.
  • Element capture throws: The element handle may no longer refer to an element attached to the page. Find or wait for the element again immediately before calling its screenshot method.
  • The returned data is not ready when you use it: Await page.screenshot() before accessing or writing the result.
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 one-request screenshot API, ScreenshotNeo accepts a URL and returns an image or PDF. The example saves a WebP response to a file; see the ScreenshotNeo API documentation for options and setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.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 or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response includes X-Page-Verdict and X-Billed headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does Puppeteer support WebP screenshots?

Yes. Set type: 'webp' or use a .webp output path.

What is the default screenshot format in Puppeteer?

PNG is the documented default format.

What quality should I use for JPEG or WebP?

Puppeteer documents a 0–100 range for applicable formats but does not prescribe a universal best value; assess the output for your use case.

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.