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

Direct answer: Chrome’s chrome.tabs.captureVisibleTab() method captures the visible area of the active tab; it does not accept a CSS selector or element rectangle. To screenshot one element, let a content script let the user pick the element, record its getBoundingClientRect() values, ask the extension service worker to capture the tab, and crop the returned image using the correct bitmap-to-viewport scale.

How the element-screenshot workflow works

The implementation has three separate jobs:

  1. Selection: a content script draws a temporary picker and records the selected element’s viewport rectangle.
  2. Capture: the service worker calls chrome.tabs.captureVisibleTab(), because content scripts cannot call the Tabs API.
  3. Cropping: image processing trims the full visible-tab bitmap to the selected rectangle and exports the result.

The Tabs API describes this as capturing the visible area of the currently active tab. A single call therefore cannot include pixels that are outside the viewport. The API is also documented as expensive and limited to two calls per second, so select first and capture once rather than taking a screenshot for every mouse movement.

Build a minimal Manifest V3 extension

1. Create the manifest

Use activeTab for a user-invoked capture. It grants temporary access to the current tab without asking for broad permanent site access. The scripting permission lets the service worker inject the picker after the user clicks the extension action.

{
  "manifest_version": 3,
  "name": "Element Screenshot Picker",
  "version": "1.0.0",
  "description": "Capture a selected element from the visible tab.",
  "permissions": ["activeTab", "scripting"],
  "background": {
    "service_worker": "service_worker.js"
  },
  "action": {
    "default_title": "Capture an element"
  }
}

This avoids <all_urls>. That broader permission is another documented option, but it is unnecessary when the feature always starts with an explicit toolbar click.

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

2. Inject a picker from the service worker

Save this as service_worker.js. The action handler injects picker.js into the tab. The message listener then captures the visible tab and returns its data URL to the picker.

chrome.action.onClicked.addListener(async (tab) => {
  if (!tab.id) return;

  try {
    await chrome.scripting.executeScript({
      target: { tabId: tab.id },
      files: ['picker.js']
    });
  } catch (error) {
    console.error('Could not start the picker:', error);
  }
});

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.type !== 'captureElement' || !sender.tab || !sender.tab.id) {
    return;
  }

  const windowId = sender.tab.windowId;

  chrome.tabs.captureVisibleTab(windowId, { format: 'png' })
    .then((dataUrl) => {
      sendResponse({ ok: true, dataUrl });
    })
    .catch((error) => {
      sendResponse({ ok: false, error: error.message });
    });

  // The response is sent after the asynchronous capture completes.
  return true;
});

The tab must still be the active tab when the capture runs. If the user changes tabs between selection and capture, the result can belong to the newly active tab or the request can fail, depending on the timing.

3. Add the picker and cropper

Save this as picker.js. The overlay uses pointer-events: none, so page clicks still reach the real element. The selected rectangle is clipped to the viewport because only visible pixels can exist in the captured bitmap.

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
(() => {
  if (window.__elementPickerRunning) return;
  window.__elementPickerRunning = true;

  const outline = document.createElement('div');
  const label = document.createElement('div');
  outline.style.cssText = 'position:fixed;z-index:2147483647;pointer-events:none;border:2px solid #1683ff;background:rgba(22,131,255,.12);display:none;';
  label.textContent = 'Click an element (Esc to cancel)';
  label.style.cssText = 'position:fixed;z-index:2147483647;pointer-events:none;top:8px;left:8px;padding:6px 9px;background:#111;color:#fff;font:12px sans-serif;border-radius:4px;';
  document.documentElement.append(outline, label);

  function removePicker() {
    outline.remove();
    label.remove();
    document.removeEventListener('mousemove', onMove, true);
    document.removeEventListener('click', onClick, true);
    document.removeEventListener('keydown', onKey, true);
    window.__elementPickerRunning = false;
  }

  function onMove(event) {
    const element = document.elementFromPoint(event.clientX, event.clientY);
    if (!element || element === outline || element === label) return;
    const rect = element.getBoundingClientRect();
    outline.style.left = `${rect.left}px`;
    outline.style.top = `${rect.top}px`;
    outline.style.width = `${rect.width}px`;
    outline.style.height = `${rect.height}px`;
    outline.style.display = 'block';
  }

  function onClick(event) {
    event.preventDefault();
    event.stopPropagation();

    const element = document.elementFromPoint(event.clientX, event.clientY);
    if (!element) return;
    const rect = element.getBoundingClientRect();
    const left = Math.max(0, rect.left);
    const top = Math.max(0, rect.top);
    const right = Math.min(window.innerWidth, rect.right);
    const bottom = Math.min(window.innerHeight, rect.bottom);
    const clipped = { left, top, width: right - left, height: bottom - top };

    removePicker();
    if (clipped.width <= 0 || clipped.height <= 0) return;

    chrome.runtime.sendMessage({
      type: 'captureElement',
      rect: clipped,
      viewport: { width: window.innerWidth, height: window.innerHeight }
    }).then((result) => {
      if (!result || !result.ok) {
        alert(`Capture failed: ${result?.error || 'unknown error'}`);
        return;
      }
      cropAndDownload(result.dataUrl, clipped, {
        width: window.innerWidth,
        height: window.innerHeight
      });
    }).catch((error) => alert(`Capture failed: ${error.message}`));
  }

  function onKey(event) {
    if (event.key === 'Escape') removePicker();
  }

  function cropAndDownload(dataUrl, rect, viewport) {
    const image = new Image();
    image.onload = () => {
      // The screenshot bitmap can be larger than the CSS viewport on high-DPI displays.
      const scaleX = image.naturalWidth / viewport.width;
      const scaleY = image.naturalHeight / viewport.height;
      const sx = Math.max(0, Math.round(rect.left * scaleX));
      const sy = Math.max(0, Math.round(rect.top * scaleY));
      const sw = Math.min(image.naturalWidth - sx, Math.round(rect.width * scaleX));
      const sh = Math.min(image.naturalHeight - sy, Math.round(rect.height * scaleY));
      if (sw <= 0 || sh <= 0) return;

      const canvas = document.createElement('canvas');
      canvas.width = sw;
      canvas.height = sh;
      canvas.getContext('2d').drawImage(image, sx, sy, sw, sh, 0, 0, sw, sh);
      canvas.toBlob((blob) => {
        if (!blob) return;
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = 'element-screenshot.png';
        link.click();
        setTimeout(() => URL.revokeObjectURL(url), 1000);
      }, 'image/png');
    };
    image.src = dataUrl;
  }

  document.addEventListener('mousemove', onMove, true);
  document.addEventListener('click', onClick, true);
  document.addEventListener('keydown', onKey, true);
})();

Load the folder as an unpacked extension in Chrome’s extension manager, click its toolbar button, select an element, and check your downloads folder for element-screenshot.png.

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

Why coordinate scaling matters

getBoundingClientRect() reports CSS pixels in viewport coordinates. The captured image is a bitmap whose dimensions can differ because of device-pixel ratio, browser zoom, or display scaling. The cropper therefore calculates naturalWidth / innerWidth and naturalHeight / innerHeight independently. Assuming a one-to-one mapping produces crops that are too small, too large, or shifted on Retina displays.

Use the clipped rectangle for elements partly outside the viewport. A horizontally or vertically clipped element produces only the visible portion. An element that extends below the viewport requires a different design: scroll, capture each position, and stitch the images, or use a server-side full-page renderer. One captureVisibleTab() call cannot create off-screen pixels.

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.

Permissions and page boundaries

  • Content scripts versus extension context: the picker can inspect the DOM, but only the service worker or an extension page should call the Tabs API.
  • activeTab: it is suitable for a button-driven workflow and gives temporary access to the current tab. Use <all_urls> only when the product genuinely needs standing access.
  • Special pages: Chrome documents that activeTab can capture sensitive pages such as chrome: pages, other extension pages, and data: URLs; file URLs require file access.
  • Frames: a top-level content script cannot inspect the DOM inside a cross-origin iframe. It can select the iframe element itself, but selecting a node inside it requires code running in that frame and permissions appropriate to that origin.
  • Browser interface: the API captures webpage pixels, not the address bar, toolbar, or other Chrome UI.

Reliability, performance, and output choices

Capture once, not continuously

Do not call the capture API from mousemove. Highlight candidates locally and issue one capture after the click. Chrome documents a maximum of two calls per second and describes the method as expensive.

Keep the selection stable

Remove the overlay before capturing so it cannot appear in the result. Avoid triggering layout changes between measuring the rectangle and calling the API. For animated elements, pause the animation with temporary CSS or accept that the captured frame may differ slightly from the preview.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Choose an output format

PNG preserves text and transparency. If file size matters, request JPEG in captureVisibleTab() and pass a quality value, then crop to a JPEG blob. WebP output can be produced by the canvas if the browser accepts image/webp. The example uses PNG because it is lossless and predictable.

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

Protect captured data

The full-tab data URL passes through extension messaging before cropping. Do not log it, send it to an analytics endpoint, or retain it longer than necessary. Treat screenshots as potentially sensitive page content and revoke the final object URL after download.

Troubleshooting

Symptom Likely cause Fix
Cannot access contents of url The picker was not injected with a user gesture, or the page is restricted. Start from the extension action and verify the page is one that Chrome permits your extension to access. Add broader host permissions only when required.
The crop is offset or the wrong size CSS viewport coordinates were treated as bitmap pixels. Scale each axis using the captured image dimensions divided by the viewport dimensions.
The screenshot includes the blue outline The overlay remained in the page during capture. Remove the picker before sending the capture message, as the sample does.
Only part of a large element appears The element extends outside the visible viewport. Scroll-and-stitch multiple captures or use a renderer that supports full-page capture; a single visible-tab call cannot include off-screen content.
No response from the service worker The asynchronous message listener did not keep its channel open. Return true from onMessage and call sendResponse after captureVisibleTab() resolves.
Capture fails after switching tabs The API targets the currently active tab. Keep the selected tab active until the response arrives, or cancel and restart the picker.
Rapid captures fail or are throttled The documented two-calls-per-second limit was exceeded. Debounce requests and capture only after a final selection.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server when you need a rendered page or selector capture without shipping a Chrome extension. It supports full-page screenshots, one-element capture by CSS selector, device and viewport settings, retina scale, waits, custom JavaScript and CSS, cookies and headers, blocking selected resources, PDFs, caching, signed links, asynchronous jobs, bulk capture, and an MCP server for Claude, Cursor, and other MCP clients.

One request returns an image or PDF. See the ScreenshotNeo documentation for selector and rendering options:

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://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Before capture, ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. The free plan includes 1,000 screenshots per month with no card. Paid plans are Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000; yearly billing gives two months free, and every feature is available on every plan.

Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without a card.

FAQ

Can the extension capture Chrome’s address bar or toolbar?

No. captureVisibleTab() is limited to the active tab’s webpage area; Chrome’s own interface is outside that capture surface.

Frequently Asked Questions

Can the extension capture Chrome’s address bar or toolbar?

No. captureVisibleTab() captures the webpage area of the active tab, not Chrome’s own interface.

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.

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.