Recommended Free Tools
Use an <img> element with a valid src and meaningful alt text:
<img src="images/photo.jpg" alt="A red bicycle beside a brick wall" width="800" height="600">
The src value can be a relative path to a file in your site or an absolute URL on another server. Add intrinsic dimensions to prevent layout shifts, and use srcset, sizes, or picture when the browser must choose among image files.
The basic HTML image
For one image resource, HTML uses the img element and its src attribute. The element is void, so it does not need a closing tag.
<img src="images/photo.jpg" alt="A red bicycle beside a brick wall" width="800" height="600">
srcidentifies the image resource.altsupplies an accessible text equivalent and appears when the image cannot load.widthandheightdescribe the intrinsic aspect ratio and let the browser reserve space before downloading.
The URL must resolve to a non-empty, valid image resource. Static or animated bitmap formats and a single-page vector image can be used. Scripted SVG, multipage PDF, HTML, and plain-text documents are not conforming image resources for img.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Import a local image with a relative path
A relative URL is resolved from the URL of the HTML document, not from your computer’s source-project window. A simple site might be arranged like this:
project/
├── index.html
└── images/
└── photo.jpg
Because index.html and images are siblings, use:
<img src="images/photo.jpg" alt="Mountain reflected in a lake">
Nested pages
If the document is at articles/travel/index.html and the image remains at images/photo.jpg in the project root, go up two directories:
<img src="../../images/photo.jpg" alt="Mountain reflected in a lake">
A leading slash such as /images/photo.jpg is root-relative to the website’s domain. It is useful when every page serves from the same site root, but it can break when the application is deployed under a subdirectory. A relative path is usually safer for portable static projects.
Paths that commonly fail
- Use forward slashes, even on Windows:
images/photo.jpg. - Match spelling and capitalization exactly. A file named
Photo.JPGis different fromphoto.jpgon many servers. - Do not point at a file that exists only on your laptop; copy it into the deployed site or use a reachable remote URL.
- URL-encode spaces and special characters, or preferably use simple names such as
hero-summer.jpg.
Import an image from another website
Use the complete HTTPS URL when the image is hosted on a CDN or another domain:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →<img src="https://cdn.example.com/products/lamp.webp" alt="White desk lamp" width="1200" height="900">
The remote server must be reachable and return an actual image with an appropriate content type. Hotlink protection, authentication, a redirect to an HTML error page, or a removed file can make a syntactically correct tag appear broken. You generally do not need CORS merely to display an image, but a cross-origin image used by canvas requires the server’s permission and an appropriate crossorigin setup.
Rank #2
Write useful alternative text
alt is not a caption or a filename. Describe the information the image contributes to someone who cannot see it.
Informative image
<img src="chart.png" alt="Sales rise from January through June, then level off in July">
Functional image
If an image is the content of a link or button, describe its action:
<a href="/home"><img src="logo.svg" alt="Home"></a>
Decorative or redundant image
Use an empty value when the image adds no information or repeats text already present:
<img src="ornament.svg" alt="">
Never omit alt accidentally and never use a filename such as IMG_4821.jpg as a substitute for a description.
Make images responsive with srcset and sizes
When the same image is available at several resolutions, list candidates with width descriptors. Tell the browser how wide the image slot will be with sizes:
Rank #3
<img
src="photo-800.jpg"
srcset="photo-400.jpg 400w, photo-800.jpg 800w, photo-1200.jpg 1200w"
sizes="(max-width: 600px) 100vw, 800px"
alt="A red bicycle beside a brick wall"
width="800"
height="533">
The browser combines the viewport, device pixel ratio, network conditions, and the declared slot width to select a candidate. With w descriptors, sizes is required. A density descriptor can be used when the displayed size is fixed:
<img src="logo.png" srcset="logo.png 1x, [email protected] 2x" alt="Example company" width="200" height="80">
Keep the fallback src usable for browsers or situations where candidate selection is unavailable.
Use picture for formats and art direction
Use picture when you need different crops for different layouts or want to offer modern formats with a fallback:
<picture>
<source media="(max-width: 600px)" srcset="portrait-crop.jpg">
<source type="image/avif" srcset="photo.avif">
<source type="image/webp" srcset="photo.webp">
<img src="photo.jpg" alt="A red bicycle beside a brick wall" width="1200" height="800">
</picture>
The browser evaluates source elements in order and uses the nested img as the required fallback. A media condition is for art direction; a type condition is for format support. Do not put the alt on source; it belongs on the fallback img.
Performance and layout stability
Reserve the correct space
Set accurate width and height values, even when CSS later makes the image fluid:
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
img {
max-width: 100%;
height: auto;
}
The attributes preserve the aspect ratio while the file is loading and reduce cumulative layout movement. Incorrect dimensions can reserve the wrong shape and cause a visible jump when the image arrives.
Lazy-load only suitable images
For images well below the initial viewport, use:
<img src="gallery-01.jpg" alt="Coastal trail" width="1200" height="800" loading="lazy">
Do not lazily load a prominent hero or other image needed immediately; delaying it can hurt perceived loading. The browser fetches a lazy image as it approaches the viewport.
Control decoding and priority when justified
HTML also supports decoding="async", decoding="sync", and decoding="auto", plus fetchpriority, referrerpolicy, and crossorigin. These are tuning controls, not replacements for correctly sized files and an accurate responsive strategy. Use them only when you understand the loading trade-off for that image.
Diagnose a broken image
- Open the final image URL directly in a browser. If it fails there, fix the URL, deployment, permissions, or server response first.
- Inspect the browser’s Network panel. A 404 usually means a path or case error; a redirect to an HTML page means the endpoint is not an image.
- Confirm the response has an image content type and contains image bytes rather than an access-denied message.
- Check the document’s actual URL and recompute every
../segment from that location. - For remote images, test whether hotlink protection, authentication, a firewall, or a temporary outage blocks the request.
- If the image loads but appears distorted, compare its intrinsic dimensions with the HTML
widthandheight, then verify your CSS.
When srcset chooses the wrong file
Check that every candidate has the correct descriptor and that sizes describes the rendered slot, including media-query changes. A browser may deliberately choose a smaller or larger file based on device pixel ratio and network conditions; that is expected behavior, not necessarily an error.
When a picture fallback is missing
Ensure the picture contains an img. Without it, there is no universal fallback or location for the required alternative text.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
Choosing the right element
| Need | Use | Key detail |
|---|---|---|
| One fixed resource | img src |
Provide meaningful alt and dimensions. |
| Same scene at several resolutions | img srcset sizes |
Use width descriptors and required sizes. |
| Different crops or formats | picture source img |
Keep an img fallback with alt. |
| Decorative visual | img alt="" |
Do not expose redundant content to assistive technology. |
Or skip the browser setup
If you need a rendered screenshot of a page rather than an image embedded in your own HTML, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF; it accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.
Example request (see the ScreenshotNeo API documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
You can also use an MCP client such as Claude or Cursor with ScreenshotNeo’s take_screenshot, get_page_info, and capture_pdf tools. The service supports full-page and element captures, device presets, custom viewport and retina scale, PDF settings, HTML/CSS rendering, JavaScript and clicks, selector waits, request blocking, headers, cookies, user agents, timezone and geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account.
Free tools Windows power users keep installed
One-click scans. No signup required.
Frequently Asked Questions
Can an HTML image use a local computer file path?
Not reliably on a deployed website. Use a file included in the site’s served directory with a relative or root-relative URL, or use a reachable HTTPS URL.
Is an image URL required to end in .jpg, .png, or another extension?
No. The server response and actual bytes determine whether it is a valid image; an extension is helpful but not decisive.
Should every image have a non-empty alt attribute?
Every image needs an alt value. Use descriptive text for informative or functional images and an empty value (alt="") for purely decorative or redundant images.
Quick Recap
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.




