Skip to content

Screenshot one element of a page

To screenshot one element of a web page, add a CSS selector to a CurlShot request, for example selector=h1 or selector=.pricing-table. CurlShot opens the page, finds the first element that matches and returns an image of that element alone, cropped to its edges. To cut out a fixed area instead, give its position and size in pixels.

Request
curl "https://curlshot.com/api/v1/screenshot?access_key=YOUR_ACCESS_KEY&url=https://example.com&selector=p" \
  --output element.png

How to screenshot one element of a web page in three steps

  1. 1

    Create a free account and copy your access key.

  2. 2

    Find the CSS selector of the element: its id, its class or its tag.

  3. 3

    Add selector to the request and save the image that comes back.

A CSS selector or a rectangle: which to use

There are two ways to capture part of a page. A selector follows the element wherever it is; a rectangle cuts out the same pixels every time. Use one or the other: sending both is refused.

Show the table (5 rows)
Compareselectorclip_x, clip_y, clip_width, clip_height
You giveA CSS selector, such as #pricing or .infoboxA position and a size in pixels, from the top left of the page
The image isThe first matching element, cropped to its edgesExactly that rectangle
Survives layout changesYes, as long as the selector matchesNo: a moved element leaves the rectangle
Nothing thereselector_not_found (422), not counted against your quotaYou get whatever is in that area
Formatspng, jpeg, webppng, jpeg, webp
  • An element that appears late: add wait_for_selector with the same selector.
  • A transparent background around a logo or a badge: omit_background=true with png or webp.
  • Test the selector first in your browser console with document.querySelector.
  • Write # as %23 in a GET request, or send the request as POST.
The infobox of the Wikipedia article about the Eiffel Tower, captured on its own
selector=.infobox on a Wikipedia article: only the infobox, cropped to its edges.

What people use it for

  • A chart or a dashboard tile as an image for a report or an email
  • A pricing table, a testimonial or a product card on its own
  • One component of your app for the docs
  • Watching one part of a page for changes

For developers: one request

The same thing from your own code. It is a plain HTTP request, so it works from any language. Create a free account to get an access key.

Questions people ask

How do I take a screenshot of a specific element?

Add selector to a CurlShot request with the CSS selector of the element. The image contains that element and nothing else.

What if the element appears late?

Add wait_for_selector with the same selector. The screenshot is taken only after the element is visible.

Can I capture an area by coordinates?

Yes. clip_x, clip_y, clip_width and clip_height cut out a rectangle of the page, measured in pixels from its top left corner.

Can I hide things inside or around the element?

Yes. hide_selectors hides any elements you name, and styles adds your own CSS to the page before the screenshot.

Take as many screenshots as you need

A free account gives you 100 screenshots every month and keeps them in one place. No card needed.