How to Take a Screenshot of a Single Element in Chrome DevTools
Right-click an element in the Elements panel of Chrome DevTools and select "Capture node screenshot" to save just that element as a PNG. This is useful when you want an image of a single part, such as a button or card, for a design review, a bug report, or documentation. You don't need to capture the whole screen and crop it in an image editor. I also checked which parts of shadows, borders, and fixed headers end up in the image by measuring the size and colors of the captured images.
Test environment: Chrome for Testing 158.0.8127.36 (the build bundled with Playwright) on a virtual display running Ubuntu 24.04. DevTools was docked on the right side of the window, and the UI was in English. I keep the menu names in English below. The test page was served with python3 -m http.server at http://localhost:8080/. I did not test on macOS or Windows Chrome, on regular Google Chrome, or with devicePixelRatio changed in device mode.
- 1. Right-click in the Elements panel and select "Capture node screenshot"
- 2. The image is saved to the Downloads folder and also copied to the clipboard
- 3. The captured area extends to the outside of the border
- 4. Elements with a transparent background include the background behind them
- 5. Elements that extend past the viewport are captured in full without scrolling
- 6. If the element is hidden under a fixed header, the header is captured too
Right-click in the Elements panel and select "Capture node screenshot"
Follow these steps:
- Open the page and open the Elements panel in DevTools.
- Right-click the row for the element you want to capture (for example,
<div class="card" ...>). - Select "Capture node screenshot" from the menu.

The menu has many items, but "Capture node screenshot" was near the bottom, between "Switch to accessibility tree" and "Scroll into view". The official DOM documentation also describes how to right-click in the Elements panel and select Capture node screenshot.
You can also do the same thing from the command menu. With the element selected, open the command menu (Ctrl+Shift+P, or Command+Shift+P on Mac) and type "node screenshot". Only one candidate, "Capture node screenshot", appeared, and pressing Enter ran it. The saved image was the same size as the one captured from the right-click menu. For how to open the command menu, see the official command menu documentation.
The image is saved to the Downloads folder and also copied to the clipboard
In my test environment, selecting the menu item saved a PNG to the Downloads folder. Chrome was set not to ask where to save files before downloading, so no save dialog opened. The file was named localhost_8080_.png, which resembles the URL of the open page (localhost:8080).
At the same time, DevTools showed the notice "Screenshot copied to clipboard". When I read the clipboard contents, the format was image/png, and the image matched the saved file in both size and colors.
The captured area extends to the outside of the border
The card I used for testing has the following CSS:
.card { width: 300px; padding: 16px; border: 2px solid #00c8e8; background: #ffffff; font-size: 20px; }
When I captured this card, the saved image was 336×63px. The width is the width value of 300px plus the left and right padding (16px × 2) and border (2px × 2). This matches the element's offsetWidth (336) and offsetHeight (63). The four corners of the image were the border color (#00c8e8). The margin area is not included.
I added the following decorations to the same card and captured each version:
| Card CSS | How it looks on the page | Captured image |
|---|---|---|
box-shadow: 0 0 0 12px #d85878 |
A 12px pink shadow around the card | 336×63px. 0 pink pixels |
outline: 8px solid #d85878; outline-offset: 4px |
A pink outline around the card | 336×63px. 0 pink pixels |
width: 200.5px; height: 100.4px (padding and border set to 0) |
Width 200.5px, height 100.390625px (value from getBoundingClientRect) |
201×100px |
On the page, the shadow appeared outside the border. The outline is also drawn outside the border, as described in the MDN documentation for outline-offset. Neither appeared in the image, and the size was still 336×63px, the same as the undecorated card.

For an element with a fractional width or height, the captured size was the rounded integer size (201×100px), the same as offsetWidth and offsetHeight.
Elements with a transparent background include the background behind them
The saved PNG used a format that supports transparency (RGBA). However, when I checked every pixel in the 10 images captured for this article, all of them had an alpha value of 255, meaning none were transparent.
When I captured a card with background: transparent, the inside of the card showed the page background color (#eefafd) behind it. It was not transparent.
A card with rounded corners (border-radius: 40px) behaved the same way. The four corners of the image (outside the rounded shape) showed the page background color. The result was not an image with a transparent background cut out in the shape of the rounded corners.
If you capture a button with a transparent background, the background behind it is included in the image. This method cannot produce an image meant to be placed over a different background.
Elements that extend past the viewport are captured in full without scrolling
I captured a card with a height of 1500px (1536px including border and padding) while the page was still scrolled to the top (scrollY at 0). The card extended below the visible area, and the viewport height was 799px.
The saved image was 336×1536px, and it showed the entire card. This card has a gradient from white (#ffffff) at the top to light blue (#00c8e8) at the bottom. When I read the colors from the middle column of the image from top to bottom, y=2 was #ffffff, y=800 was #7ae2f3, and y=1500 was #06c9e9. The color gets closer to light blue toward the bottom, so the part of the card that is taller than the viewport (799px) is captured without being cut off. scrollY stayed at 0 after the capture, so the page did not scroll.
The same is true when capturing a card that is below the visible area at the bottom of the page. The image was 336×63px, and the page did not scroll. You don't need to scroll to the element before capturing it.
In both cases, the captured size matched the element's offsetWidth × offsetHeight.
If the element is hidden under a fixed header, the header is captured too
On a page with a 56px-high header fixed to the top with position: fixed, I scrolled until the top edge of the card was 20px below the top of the screen, then captured it. The upper part of the card was hidden under the header.
The saved image was 336×63px, but the top 36px (rows y=0 to 35) showed the header. This is the 56px − 20px = 36px area where the header overlaps the card. Apart from the white text in the header, the color was the header's background color (#067a98).

Other elements that overlap the target element are also included in the image as they are. When I captured the same card at the top of the page, where the card was not covered by the header, the header's color did not appear.
On pages with position: fixed elements, such as a fixed header or a chat button, check whether anything overlaps the element you want to capture before taking the screenshot. If something does overlap, scroll to a position where the element is not covered, then capture it again.





