Remove images from HTML with precise control: strip all <img> tags, remove only external images while keeping local ones, filter images by URL, attribute or parent element, and clean up <picture> tags, responsive srcset markup, and CSS background images. Paste your HTML below to get started.
The Remove Images from HTML tool is a professional HTML cleanup utility that lets you
delete or remove images from HTML with precise control. Instead of a blunt find-and-replace on <img>
tags, it can detect external images, filter images by URL, attribute or parent element,
clean up <picture> and responsive srcset markup, remove empty image
containers, and even strip CSS background-image declarations — all while leaving the
rest of your HTML untouched.
An HTML image is content embedded with the <img> tag, typically referencing a file
through the src attribute:
<img src="/images/photo.jpg" alt="A photo">
Modern HTML also loads images through <picture> and <source>
elements, responsive srcset/sizes attributes, lazy-loading attributes such as
data-src and data-lazy-src, and CSS background-image declarations.
An image is external when it is loaded from a different domain than your own website.
For example, if your domain is mysite.com:
<img src="https://example.com/image.jpg"> <!-- external -->
<img src="//cdn.example.com/image.jpg"> <!-- external (protocol-relative) -->
<img src="/images/photo.jpg"> <!-- local -->
<img src="images/photo.jpg"> <!-- local -->
Protocol-relative URLs (starting with //) inherit the current page's protocol but still point
to another host, so this tool treats them as external. External images are also detected inside
srcset, data-src, data-srcset, data-lazy-src, and
<source> elements inside <picture>.
This distinction matters when cleaning up scraped or copied HTML: you often want to keep your own images while removing references to third-party image hosts that may go offline, leak referrer data, or slow down your page.
<img src="..."> loads a single image source.srcset and sizes let the browser pick the best image for the screen size
and resolution from a list of candidate URLs.<picture> wraps multiple <source> elements plus a fallback
<img>, allowing different image formats or crops per device.data-src, data-srcset and data-lazy-src are used by
lazy-loading scripts to defer loading an image until it scrolls into view.
A CSS background-image is not an HTML element — it is a style declaration, either
inline or inside a <style> block:
<div style="background-image: url('https://example.com/bg.jpg');"></div>
Because it lives inside CSS rather than markup, removing it means stripping the declaration itself rather
than deleting an HTML element. This tool treats CSS background image cleanup as a separate, optional step
so it never interferes with your regular <img> removal settings.
Input HTML (your domain: mysite.com):
<img src="https://example.com/banner.jpg" alt="Banner">
<img src="/images/logo.png" alt="Logo">
<img src="//cdn.other.com/ad.jpg" alt="Ad">
Output HTML:
<img src="/images/logo.png" alt="Logo">
Only the images pointing to example.com and cdn.other.com were removed; the
locally hosted logo was preserved.
src or srcset matches a URL fragment, e.g. example.com/images/.product-image.article, .product, #sidebar..image-wrapper div) together with the image.background-image declarations, optionally external ones only.Paste your HTML above, choose exactly what to remove — all images, external images only, images by URL or attribute, images inside a container, or CSS background images — and get clean, ready-to-use HTML instantly, along with detailed before/after statistics.