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

Optimize responsive images in two steps: serve a source close to the dimensions the page actually renders, then choose an image format and compression level that suit the content and your visitors’ browsers. Use srcset and sizes for the same image at different resolutions; use <picture> when the format or crop should change. No single format or quality setting is best for every image.

How responsive image selection works

A browser needs to know which image files are available and how large the image will appear in the layout. With width-descriptor candidates such as 480w and 960w, srcset lists the available source widths, while sizes describes the expected rendered slot width. The browser combines that slot estimate with the device pixel ratio (DPR) to choose an available candidate. It may choose a candidate somewhat larger or smaller than its ideal target because it can select only among the files you provide. See MDN’s responsive images guide.

The key is to describe the image’s actual layout size, not to use the viewport width by habit. A 100vw estimate is inaccurate, for example, when an image sits in a centered column, beside a sidebar, or inside a grid with fixed gaps.

Width descriptors for fluid layouts

Use width descriptors when the same composition is displayed at different CSS widths. Generate several real versions of the image, then list each file with its intrinsic width:

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.
<img
  src="/images/river-960.jpg"
  srcset="/images/river-480.jpg 480w,
          /images/river-960.jpg 960w,
          /images/river-1440.jpg 1440w"
  sizes="(max-width: 640px) 100vw,
         (max-width: 1100px) 80vw,
         720px"
  width="1440"
  height="960"
  alt="A river winding through a forested valley">

Here, the layout is described as full viewport width up to 640 CSS pixels, 80% of the viewport up to 1100 pixels, and 720 CSS pixels above that. Change those conditions and values to match your own CSS layout. The width and height attributes describe the source’s intrinsic dimensions and help the browser reserve space; CSS can still scale the image responsively.

Density descriptors for a fixed rendered size

If an image always occupies a known CSS size and only pixel density varies, density descriptors such as 1x and 2x are an alternative:

<img
  src="/images/logo.png"
  srcset="/images/logo.png 1x, /images/logo-2x.png 2x"
  width="160"
  height="40"
  alt="Example company">

Do not mix w and x descriptors in one srcset candidate set. The sizes attribute is used with width-descriptor selection, not density-descriptor selection. MDN explains the distinction in its responsive images guidance.

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.

Resolution switching versus art direction

Resolution switching supplies the same image composition at different pixel dimensions. Art direction deliberately changes the crop or composition for a layout condition—for example, a wide landscape crop on desktop and a tighter portrait crop on a narrow screen. Use srcset for the first problem and media-conditioned <source> elements inside <picture> for the second. The MDN picture reference describes how the browser selects a matching supported source.

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.

Offer newer formats with a fallback

When format support differs across the intended browser audience, put format alternatives before the fallback image. The browser uses the first supported source that matches; unsupported MIME types are skipped. Keep the nested <img>: it provides the fallback and the shared alternative text and dimensions.

<picture>
  <source
    type="image/avif"
    srcset="/images/river-480.avif 480w,
            /images/river-960.avif 960w,
            /images/river-1440.avif 1440w"
    sizes="(max-width: 640px) 100vw,
           (max-width: 1100px) 80vw,
           720px">
  <source
    type="image/webp"
    srcset="/images/river-480.webp 480w,
            /images/river-960.webp 960w,
            /images/river-1440.webp 1440w"
    sizes="(max-width: 640px) 100vw,
           (max-width: 1100px) 80vw,
           720px">
  <img
    src="/images/river-960.jpg"
    srcset="/images/river-480.jpg 480w,
            /images/river-960.jpg 960w,
            /images/river-1440.jpg 1440w"
    sizes="(max-width: 640px) 100vw,
           (max-width: 1100px) 80vw,
           720px"
    width="1440"
    height="960"
    alt="A river winding through a forested valley">
</picture>

Each format’s candidate list should represent the corresponding versions at the declared widths. If the image does not need responsive resolution switching, a simpler source list may be enough.

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.

Use media conditions for a different crop

For a genuine art-direction change, add a matching media condition to the alternate crop and retain a fallback in <img>:

<picture>
  <source
    media="(max-width: 600px)"
    srcset="/images/river-portrait.webp"
    type="image/webp">
  <source
    media="(max-width: 600px)"
    srcset="/images/river-portrait.jpg"
    type="image/jpeg">
  <img
    src="/images/river-landscape.jpg"
    width="1440"
    height="960"
    alt="A river winding through a forested valley">
</picture>

The media condition determines whether that crop applies; the MIME type lets the browser skip a format it does not support. Keep source order intentional, and ensure the fallback is appropriate for browsers or conditions not covered by the alternate sources.

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

Choose an image format for the content

Format choice is a balance among acceptable visual quality, transfer size, browser support, and image characteristics—not a contest with one winner. MDN’s image format guide describes format capabilities; check support against your actual audience when choosing a delivery default.

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
Format Useful for Trade-off to consider
AVIF Still or animated imagery where strong compression is useful; it supports transparency and higher bit depth. Check target-browser support and provide a fallback when needed.
WebP Lossy or lossless images, transparency, and animation; broad modern browser support is described in the cited guidance. Compare the resulting bytes and appearance for the specific image rather than assuming it will always be smaller or better.
JPEG Photographs where a broadly compatible lossy format is useful, including as a fallback. Lossy compression can create visible artifacts, particularly around sharp edges or text.
PNG Images needing lossless reproduction or transparency. For some images, WebP or AVIF may compress more efficiently where supported and visually suitable.
SVG Scalable icons, interface graphics, and diagrams naturally represented as vectors. It is not a general substitute for raster photographs.
JPEG XL Use cases that need its advanced capabilities and whose browser audience supports it. MDN reports non-universal browser support; do not assume it is a universal delivery default.

These are format capabilities, not a universal ranking by file size. The output depends on the image and encoding settings. For a site with many images, an image CDN or optimization service can automate transformations and delivery, but neither is required to use responsive HTML. Chrome for Developers discusses delivery considerations and optional tools in Improve image delivery.

Set compression by visual inspection

Lossy compression often works well for complex photographs, but it can damage crisp text, line art, and sharp boundaries. There is no universal quality number that preserves every image equally. Compare encoded candidates at their intended display dimensions, inspect important detail, and weigh visible artifacts against bytes transferred. A file-size reduction is not an improvement if it makes the content visibly worse.

Chrome for Developers points to optional software such as Squoosh, ImageOptim, and Imagemin for compression workflows. Use the tools that fit your build process; the important check is the encoded result at the size visitors will see. See also web.dev’s image performance guidance.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A practical workflow for responsive image variants

  1. Measure the rendered slots. Read the actual layout breakpoints and determine the image’s CSS width at each relevant condition, including constrained columns and grid gaps.
  2. Generate candidate widths. Create a modest set of source widths that covers those slots and the pixel densities you need to serve. Avoid keeping only a very large original if most displays render the image much smaller.
  3. Encode and compare. Try appropriate formats and compression settings for the image. Compare file size and visible quality at intended display dimensions, especially around text, fine edges, and transparency.
  4. Write the selection rules. Use width descriptors and a sizes value that mirrors the measured layout. Add ordered <picture> sources only when format fallback or a different crop is needed.
  5. Verify browser selection. At representative viewport widths and pixel densities, inspect the actual image request and rendered result in browser developer tools. MDN points to Firefox Network Monitor; Chrome documents its Network panel and image-delivery checks.

Troubleshoot common responsive-image mistakes

  • The browser downloads an image that seems too large: check whether sizes describes the actual slot. If it overstates the rendered width, the browser may choose an unnecessarily large candidate. Also inspect the candidates available for that slot and DPR.
  • A high-density screen looks soft: check that a sufficiently large candidate exists and that the width descriptors match the files’ real intrinsic widths. The browser cannot select detail absent from the candidate set.
  • The wrong crop appears: inspect the order and media conditions of the <source> elements. Confirm that the intended condition matches and that the source precedes the fallback.
  • A format source is skipped: verify the declared MIME type matches the file format and that the target browser supports it. Keep a suitable <img> fallback for unsupported formats or unmatched conditions.
  • Images shift the page as they load: provide accurate width and height attributes on the nested <img> so the browser can reserve the image’s aspect ratio.
  • Compressed edges or lettering look damaged: compare a less aggressive lossy encoding or a lossless option when appropriate. Judge at the rendered size, not just in a file-size report.
  • The markup becomes difficult to maintain: avoid generating needless variants and breakpoints. A modest candidate set aligned with real layout slots is easier to produce, test, and update.

Or skip the browser setup

If you want a rendered page screenshot to inspect how its images appear at a viewport, ScreenshotNeo is a website screenshot API and MCP server. A screenshot can help review the page rendering, but it does not replace measuring image slots, generating encoded variants, or testing which source the browser selects.

One GET request returns an image or PDF; this example saves a WebP screenshot. See the ScreenshotNeo documentation for API options and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes supported cookie-consent banners, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Sign up free for 1,000 screenshots a month, with no card required.

Frequently Asked Questions

Should I put every image on a page in a <picture> element?

No. Use a plain <img> with srcset when you need resolution switching only; reserve <picture> for format alternatives or art direction.

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

Can I use the same sizes value for every responsive image?

Only if those images share the same rendered-width rules. Base each value on that image’s actual slot in the layout.

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.