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

Put the image address in an <img> element’s src attribute. For an image stored in an images folder beside your HTML file, use <img src='images/photo.jpg' alt='Description of the image'>. Use a complete HTTPS address when the image is hosted elsewhere, such as <img src='https://example.com/images/photo.jpg' alt='Description of the image'>.

The basic HTML pattern

An image URL is the value that identifies the image file your browser should fetch. HTML does not put the image data directly in the <img> tag; it points to that data with src.

<img src='images/photo.jpg' alt='A description of the photo'>

The alt text describes the image’s purpose. It is useful when the image cannot load and for people using assistive technology. Replace the example path and description with values that match your file.

Relative path or absolute URL?

Choose the form that matches where the image is hosted. A relative path is resolved from the URL of the HTML document, not from the folder you happened to open in your editor. An absolute URL contains the complete address, including the protocol and hostname.

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.
Reference Example Best use Important limitation
Same folder photo.jpg The HTML file and image are deployed together. Moving the page or image changes what the path resolves to.
Child folder images/photo.jpg Your image is in an images directory beside the page. The directory name and capitalization must match the deployed files.
Parent folder ../images/photo.jpg The image is one directory above the page, in images. Every .. segment depends on the page’s actual location.
Absolute HTTPS URL https://example.com/images/photo.jpg The image is hosted on your site, a CDN, or another authorized host. The remote server must remain available and permit embedding.

Relative references are usually easier to move between domains because they do not contain a hostname. Absolute URLs are explicit and are useful when the image is served from a separate host or CDN.

How to find the image URL

If you control the website files

  1. Locate the image in the project, for example public/images/logo.png.
  2. Work out the URL path produced when that folder is deployed. A file in the same public folder as the page can use logo.png; a file in an images child folder can use images/logo.png.
  3. Use that path in src, then open the page through the same URL structure used by your web server.

The path on your computer is not automatically a URL for visitors. A path such as C:UsersSamPicturesphoto.jpg or /Users/sam/Pictures/photo.jpg exists only on that computer. Copy the file into the site’s deployed assets (or an image host you are authorized to use), then reference its served URL.

If the image is already visible in a browser

  1. Right-click the image and choose the browser’s command for copying the image address, if available.
  2. Alternatively, open developer tools, inspect the <img> element, and copy the value of its src attribute. Check for a srcset attribute too; it may contain several candidates rather than one fixed file.
  3. Paste the address into a new browser tab. A successful result should be the image resource itself, not an HTML error page or a login screen.

Images supplied by CSS, such as a background-image, do not have an img element. Inspect the rule or the browser’s network panel to identify the requested resource. If the address belongs to someone else, obtain permission before embedding it. Hotlinking can consume that site’s bandwidth and leaves your page dependent on a file the owner can replace or remove.

Working examples

Image beside the HTML file

<!-- index.html and photo.jpg are in the same folder -->
<img src='photo.jpg' alt='A mountain at sunrise'>

Image in a child folder

<!-- index.html is beside an images folder -->
<img src='images/photo.jpg' alt='A mountain at sunrise'>

Image hosted at a full address

<img src='https://example.com/images/photo.jpg' alt='A mountain at sunrise'>

Use an HTTPS image address when the page is served over HTTPS. Verify that you are allowed to use the file and that the host permits embedding. Do not assume that an image URL copied from a search result grants reuse rights.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Responsive image URLs with srcset and picture

A single src works for a basic image. When you have multiple files, srcset lets the browser choose among candidates. The sizes value tells it how wide the image is expected to render when candidates are described by width.

<img
  src='small.png'
  srcset='small.png 1x, large.png 2x'
  alt='A product diagram'>

That density example offers a normal-resolution file and a higher-density file. For width-based candidates, include sizes:

<img
  src='photo-640.jpg'
  srcset='photo-640.jpg 640w, photo-1280.jpg 1280w, photo-1920.jpg 1920w'
  sizes='(max-width: 700px) 100vw, 700px'
  alt='A city skyline'>

Use picture when the choice depends on media conditions or format, while keeping an img fallback:

<picture>
  <source media='(max-width: 700px)' srcset='portrait.jpg'>
  <source type='image/webp' srcset='city.webp'>
  <img src='city.jpg' alt='A city skyline'>
</picture>
Need Use What the browser receives
One resource src One image URL.
Different screen densities srcset with 1x/2x A density-appropriate candidate.
Different rendered widths srcset with width descriptors and sizes A candidate suited to the expected slot width.
Art direction or formats picture with source elements and an img fallback The first supported, matching source, or the fallback.

Why a local image is not showing in HTML

When someone says “my local image is not showing in HTML,” check the request the browser is actually making. These are the usual causes and fixes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
  • Wrong relative location: Resolve the path from the page URL. If the page is /docs/start.html, images/photo.jpg means /docs/images/photo.jpg, not necessarily a project-root images folder.
  • Filename or case mismatch: Photo.JPG and photo.jpg can be different files on a deployed server. Match spelling, capitalization, and extension exactly.
  • The file was not deployed: Confirm the image is included in the published build or upload. An editor preview can see files that the production server never received.
  • Opened from the wrong base URL: Relative paths change when a page moves between folders. Open the image URL directly and compare it with the path your markup generates.
  • The address returns HTML or an error: Paste the URL into a new tab. A redirect to a sign-in page, a 404 document, or a server error is not an image resource.
  • Spaces or special characters: Rename files to simple names, or ensure the URL is correctly percent-encoded. Do not paste an unescaped desktop path into src.
  • Remote blocking or permission: The host may disallow hotlinking, require authentication, or have removed the file. Host an authorized copy or use a permitted image-delivery service.
  • Wrong element: If the visual is a CSS background, look in the stylesheet or network requests rather than searching for an img tag.

Keep meaningful alt text even while diagnosing. If the image fails, the alternative text gives users useful context instead of an empty space.

Special URL cases

Query strings and fragments

An image URL may include a query string, such as a resize or cache parameter. Preserve the complete URL when copying it. A fragment (the portion after #) is generally a document-navigation marker and does not identify a separate image file.

Data URLs

HTML also permits a data: URL that contains the encoded image data itself. It can be useful for a tiny, self-contained asset, but it is not a path to a separately hosted file and is harder to maintain. For normal site images, use a deployed relative path or an authorized HTTPS URL.

Moving a site

Before changing a domain or folder layout, list every relative image reference and test it at the new page URL. Relative references are portable only when the corresponding directory structure moves with them; absolute references continue to point to their original host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If what you need is a clean screenshot image of a web page rather than the URL of an existing image file, ScreenshotNeo returns a PNG, JPEG, or WebP from one GET request. It accepts cookie and consent banners, removes more than 60 known consent platforms plus newsletter popups and chat widgets before capture, and lets you turn each cleanup step off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; the response identifies the page verdict and billing result in X-Page-Verdict and X-Billed headers.

Here is a runnable cURL request (replace the target URL and key):

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

Python:

import requests

r = requests.get(
    'https://api.screenshotneo.com/v1/shot',
    params={'access_key': 'YOUR_API_KEY', 'url': 'https://example.com'},
    timeout=90,
)
r.raise_for_status()
open('shot.webp', 'wb').write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

See the ScreenshotNeo documentation for all request options. In addition to full-page captures with lazy images loaded, it supports CSS-selector element captures, dark mode, 12 device presets and custom viewports, retina scale, PDF output, custom CSS and JavaScript, clicks, selector or network-idle waits, ad and tracker blocking, custom headers and cookies, user-agent and authorization values, timezone and geolocation, transparent backgrounds, resizing, a chosen cache TTL, signed links for public <img> tags, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameters used by other screenshot APIs also work, which can simplify a migration.

ScreenshotNeo includes an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. Create a free ScreenshotNeo account.

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.

A final verification checklist

  1. Confirm src contains the image URL, not a page URL or a computer-only file path.
  2. Resolve relative paths from the published page’s URL.
  3. Check filename case, extension, deployment, and URL encoding.
  4. Open the image address directly and verify that it returns the image.
  5. Use descriptive alt text and choose srcset, sizes, or picture when you have responsive alternatives.
  6. Use only images you host or have permission to embed.

Frequently Asked Questions

Can I put a normal web-page URL in an image’s src attribute?

No. The address must return an image resource. A URL that returns an HTML article, login form, or error page cannot serve as the image itself.

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.

Why does the same relative image path work on one page but not another?

Relative paths are resolved from each document’s URL. Pages in different folders can therefore need different numbers of directory segments even when they display the same file.

Do I need a separate image URL for every screen size?

Only if you provide responsive alternatives. One URL is sufficient for a basic image; use srcset, sizes, or picture when you have distinct files or formats to offer.

Is copying an image address proof that I can republish the image?

No. The address identifies the resource, but permission and licensing are separate questions. Use files you own or are authorized to embed.

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

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.