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.

To display a screenshot on a webpage, save or host the image where the page can access it, then reference it with an HTML <img> element. For example: <img src="images/homepage-screenshot.png" alt="Homepage showing the site navigation and featured article">. HTML embeds an image; it does not take a screenshot of the browser. If you need to create the screenshot automatically, use a browser capture workflow instead.

Choose the right workflow first

“Add a screenshot in HTML” can mean two different jobs. The distinction matters because the markup that displays an image cannot create that image for you.

What you need Use What it does
Show a screenshot file that already exists <img> with src Embeds an image resource in the page.
Choose among image sizes or formats for different screens srcset and sizes, or <picture> Lets the browser select an appropriate supplied image.
Capture a page repeatedly for a test or build A browser automation workflow such as Playwright Captures a page, a full page, or a selected element.
Capture content a user selects in an open browser Browser Screen Capture APIs Captures live browser content subject to permission and browser/API support.

For a tutorial, portfolio, bug report, or documentation page with a screenshot file ready, the first option is usually the answer. If you need an image generated from a rendered page, create it with a capture workflow first, then embed the resulting file with <img>.

Display an existing screenshot with an image element

Put the image somewhere the page can reach

For a project asset, place the screenshot in your site’s files—for example, in an images folder. A relative URL such as images/homepage-screenshot.png is resolved from the location of the HTML document. If you instead use an image hosted elsewhere, the URL must be available to the people who will visit your page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

File names and paths are exact: check spelling, capitalization, the file extension, and where the HTML page sits in the deployed site. A path that works on your computer may not work after deployment if the image was not uploaded or the page’s location changed.

Add the image and describe its useful content

Use src for the image resource and alt for alternative text. The alternative text should communicate the meaningful information someone would otherwise get from seeing the screenshot—not merely announce that an image is a screenshot.

<img src="images/homepage-screenshot.png"
     alt="Homepage showing the site navigation and featured article">

If the screenshot is purely decorative and contributes no essential information, use an empty alternative text value, alt="". Do not leave out the alt attribute: alternative text is fallback content for people who cannot process the image and for cases where image loading is disabled.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Set the image’s intrinsic dimensions

When you know the screenshot’s actual pixel dimensions, include them as width and height attributes. This gives the browser the image’s aspect ratio before the file finishes loading and helps it reserve the right amount of space, reducing layout movement.

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.
<img src="images/homepage-screenshot.png"
     alt="Homepage showing the site navigation and featured article"
     width="1440" height="900">

Use the image’s real intrinsic dimensions for those attributes, not an arbitrary display size. You can make the image fluid in CSS while keeping its proportions:

img {
  max-width: 100%;
  height: auto;
}

Here, the image can shrink to fit a narrow content area without stretching. The width and height attributes still describe the source image; CSS controls how large it is displayed.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Provide context with a figure and caption

A caption can tell every reader what a screenshot demonstrates or where to look. It is separate from alternative text: the caption supplies visible context, while alt provides an equivalent for meaningful visual information.

<figure>
  <img src="images/settings-screen.png"
       alt="Settings page with the notification toggle enabled"
       width="1280" height="800">
  <figcaption>The notification setting is enabled in the account settings.</figcaption>
</figure>

Use a caption when the explanation belongs alongside the image. Avoid repeating the same sentence in both the caption and alternative text; make the alternative text describe the image’s relevant content and let the caption explain its context.

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

Use responsive sources when you have multiple image files

If you have separate versions of a screenshot, srcset and sizes can describe the candidates and the space the image is expected to occupy. The browser uses that information to select a resource. In a width-descriptor list, each w value must match the actual width of its corresponding image file.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
<img src="images/dashboard-800.png"
     srcset="images/dashboard-400.png 400w,
             images/dashboard-800.png 800w,
             images/dashboard-1600.png 1600w"
     sizes="(max-width: 600px) 100vw, 800px"
     alt="Dashboard screenshot showing monthly activity"
     width="1600" height="1000">

This example offers three image widths and says the image is expected to use the full viewport width up to 600 pixels, and 800 pixels beyond that. Make sure each listed file exists and that its descriptor reflects the file’s actual width. A mismatched descriptor can lead the browser to make a poor choice.

Use <picture> with one or more <source> elements when you need art direction or want to offer different image formats. These elements describe alternatives; the browser still needs a valid image resource to display. If you have only one screenshot file and it works at the intended sizes, a plain <img> is simpler.

Use a complete HTML example

This standalone example assumes that images/homepage-screenshot.png is located relative to the HTML file. Replace the path, alternative text, and dimensions with details for your own image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Homepage screenshot</title>
  <style>
    figure {
      margin: 1rem 0;
    }

    figure img {
      display: block;
      max-width: 100%;
      height: auto;
    }
  </style>
</head>
<body>
  <main>
    <h1>Homepage screenshot</h1>
    <figure>
      <img src="images/homepage-screenshot.png"
           alt="Homepage showing the site navigation and featured article"
           width="1440" height="900">
      <figcaption>The homepage, including its navigation and featured article.</figcaption>
    </figure>
  </main>
</body>
</html>

Save the HTML file and image in the expected locations, then open the page or deploy it to your site. If you see a broken-image indicator instead of the screenshot, check the path and deployment as described below.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When the screenshot needs to be generated automatically

An <img> tag displays an image resource; it does not capture the page that contains it, capture another tab, or turn rendered HTML into a screenshot. For repeatable captures in a test, build, or automation workflow, a browser automation tool such as Playwright can capture a page, a full scrollable page, or a particular element. Choose the capture scope that matches what you need to show, then use the resulting file as the src of your image element.

The browser Screen Capture APIs address a different case: capturing user-selected live browser content from within a web application. That workflow is not the same as embedding a static screenshot and can depend on user permission and browser/API support. Do not choose it merely to display an image you already have.

Or skip the browser setup

If you want an API to create the screenshot rather than configure a browser automation workflow, ScreenshotNeo can return a screenshot or PDF from a GET request. The following cURL example saves a screenshot response as a WebP file. See the ScreenshotNeo documentation for request parameters and setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Replace YOUR_API_KEY with your key and change the target URL to the page you want to capture. ScreenshotNeo accepts cookie or consent banners as a visitor would and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; you can turn each step off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents, including Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Every feature is on every plan. Visit ScreenshotNeo for product information, or sign up free for 1,000 screenshots a month with no card.

Troubleshoot a screenshot that does not appear correctly

  • The image is broken or missing: Check that src points to the actual file, that the image was included in the deployed site, and that directory names, capitalization, and the extension match. For an external image, confirm the URL is available to the page’s visitors.
  • The image appears only on your computer: A local file location is not automatically available to visitors. Put the image in the deployed project or use a hosted image URL that visitors can access.
  • The image is stretched or distorted: Check for CSS that sets both displayed width and height to values with a different ratio from the source. Use height: auto when setting a fluid width, and ensure the HTML dimensions describe the image’s intrinsic ratio.
  • The wrong image size is selected: Verify that every srcset width descriptor matches its file’s actual width and that sizes reflects the space the image occupies at the relevant viewport widths. Also confirm that all candidate paths work.
  • The screenshot is visible but its meaning is unclear without the image: Replace generic alternative text such as “screenshot” with a concise description of the relevant screen content, or use alt="" if it is genuinely decorative.
  • You expected HTML to take the screenshot: Generate the file with a browser capture workflow first. An image element only references an existing image resource.

Practical checks before publishing

  • Confirm the screenshot file is in the project or hosted where intended visitors can access it.
  • Use a working path in src and provide an appropriate alt value.
  • Set intrinsic width and height when known, then use responsive CSS for display sizing.
  • Use srcset and sizes only when you have real image variants and accurate width descriptors.
  • Use a capture workflow instead of HTML markup when the image needs to be created from a rendered page or live browser content.

Frequently Asked Questions

Does an element copy the screenshot into the HTML file?

No. It references an image resource with a URL in src (or candidates in srcset); the image file must remain available at that location.

Can I use a screenshot as a link?

Yes. Put the <img> element inside an anchor element if selecting the screenshot should navigate somewhere. Keep the image’s alternative text meaningful, and give the link a clear purpose.

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.

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