For a normal webpage, embed a PNG with an <img> element whose src points to the image file: <img src="images/example.png" alt="A concise description of the image">. The path must resolve to a PNG that your site serves. If the PNG bytes must travel inside the HTML itself, use a data:image/png;base64, URL instead.
The standard way: reference a PNG file
The WHATWG HTML Standard says that when there is one image resource, use the img element and its src attribute. An img element is a void element, so it does not have a closing tag.
<img src="images/example.png" alt="A concise description of the image">
Here, images/example.png is the image URL. A relative URL is resolved from the location of the HTML document, while an absolute URL names the complete address of the resource.
A complete working page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PNG example</title>
</head>
<body>
<h1>Product illustration</h1>
<img src="images/product.png" alt="Blue product package on a white background">
</body>
</html>
Put product.png in an images directory alongside the page in this example. If the page is at /docs/tutorial.html and the image is at /docs/images/product.png, images/product.png is the appropriate relative path. If the image is one directory above the page, use a path such as ../images/product.png.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Use an absolute URL when the image is hosted elsewhere
<img src="https://example.com/assets/product.png" alt="Blue product package on a white background">
Only use an absolute URL when that host is intended to serve the image to your page. The URL still has to resolve to an accessible resource; changing the extension in the markup does not create or move a file.
Make the image accessible
The alt attribute is the text replacement for the image. Write what the image means in the context of the page, not merely its filename. The MDN <img> reference recommends concise alternative text and explains that alt="" is appropriate for a purely decorative image.
Meaningful image
<img src="images/chart.png" alt="Quarterly revenue rises from January through June">
A screen-reader user should receive the same useful information that the image contributes visually. If the surrounding text already conveys the complete information and the PNG adds no meaning, use an empty value:
<img src="images/ornament.png" alt="">
Do not use the filename as a substitute for a description, and do not use title in place of alt.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsKeep layout stable and support different screens
Reserve space with dimensions
If the intrinsic dimensions are known, add width and height. These attributes let the browser reserve the image’s layout space while the resource loads.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
<img src="images/product.png"
width="1200"
height="800"
alt="Blue product package on a white background">
Use the image’s real dimensions rather than values chosen only to make it look smaller. CSS can control the displayed size while the attributes preserve the intended proportions.
Offer alternate files with srcset and sizes
When you have PNG files prepared for different rendered widths or pixel densities, srcset lets the browser choose among them. sizes describes the width the image will occupy in the layout.
<img
src="images/photo-800.png"
srcset="images/photo-480.png 480w,
images/photo-800.png 800w,
images/photo-1600.png 1600w"
sizes="(max-width: 600px) 100vw, 800px"
width="800"
height="533"
alt="Mountain trail beside a lake">
The ordinary src remains the fallback. These attributes are refinements, not requirements for displaying one PNG.
Free tools Windows power users keep installed
One-click scans. No signup required.
Use <picture> for art direction
Use a picture element when different crops or source selections are needed at different conditions. Keep an inner img as the fallback.
<picture>
<source media="(max-width: 600px)" srcset="images/product-mobile.png">
<img src="images/product-wide.png" alt="Blue product package on a white background">
</picture>
Inline the PNG with a base64 data URL
If the requirement is to place the image bytes inside the markup rather than refer to a separate file, put a data URL in src:
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
<img
src="data:image/png;base64,BASE64_ENCODED_IMAGE_DATA"
alt="A concise description of the image">
Replace BASE64_ENCODED_IMAGE_DATA with the actual base64 representation of the PNG. The general syntax documented by MDN’s data-URL reference is data:[<media-type>][;base64],<data>. In this case, image/png identifies the media type and ;base64 tells the browser how to decode the following characters.
When inline data is useful
- A self-contained HTML document must carry its small image without a separate file.
- An asset is generated or assembled together with the markup.
- You need the source representation to travel as one document.
For a typical website, a normal file URL is easier to maintain, reuse and update. Base64 text makes the HTML larger and harder to read. It is an alternative representation of the same image bytes, not a way to avoid supplying those bytes.
Data-URL origin behavior
Modern browsers treat data URLs as unique opaque origins. That matters if code or other resources make assumptions about origin and security behavior; an inline image should not be treated as though it came from the page’s normal site origin.
Choose between a file URL and inline data
| Consideration | Separate PNG file | Base64 data URL |
|---|---|---|
| Markup | Short, readable src path |
Long encoded string inside the HTML |
| Maintenance | Easy to replace or update the image independently | Changing the image requires changing the document’s encoded data |
| Reuse | The same URL can be referenced by multiple pages | The encoded content is repeated wherever it is embedded |
| Portability | Requires the referenced file to travel with or remain available to the page | Can make a document self-contained |
| Accessibility | Still requires an appropriate alt value |
Still requires an appropriate alt value |
Use the separate-file approach by default. Select a data URL when self-containment outweighs the cost of bulky, less maintainable markup.
Or skip the browser setup
If the PNG you need is a screenshot of a webpage, ScreenshotNeo can return a screenshot from one GET request. It is a website screenshot API and MCP server; it can return PNG, JPEG, WebP or PDF. The API accepts options for full-page capture, lazy-loaded images, CSS selectors, custom CSS and JavaScript, waits, headers, cookies, user agents, blocking requests, resizing and more. Cookie or consent banners, newsletter popups and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.
See the ScreenshotNeo API documentation for the current parameters. The following examples use the supplied endpoint and save the returned bytes locally.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo’s MCP server exposes take_screenshot, get_page_info and capture_pdf to 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 shots. Create a free ScreenshotNeo account to get an API key.
Troubleshoot a PNG that does not appear
Broken-image icon or empty space
- Check the path relative to the HTML file, not relative to the project root you have in mind.
- Check capitalization. A path that differs from the served filename can fail on case-sensitive systems.
- Open the image URL directly in the browser. If it does not load there, the HTML reference cannot load it either.
- Confirm the PNG is included in the directory or deployment output that is actually being served.
The page works locally but not after deployment
Inspect the deployed page’s final URL and recalculate the relative path from that location. A page moved from a project root into a nested route may need ../ segments or a different absolute path. Also verify that the deployed filename and directory match the reference exactly.
The inline image is not displayed
- Make sure the prefix is exactly
data:image/png;base64,. - Do not leave the placeholder text in place; it must be replaced by the actual encoded bytes.
- Ensure the data follows the comma and that surrounding quotation marks are balanced.
- If the HTML has become unwieldy, move the PNG back to a normal file URL.
The image has no useful text for assistive technology
Rewrite alt as a concise description of the image’s relevant meaning. If it is decorative, use alt=""; do not omit the attribute or replace it with title.
Practical checklist before publishing
- Confirm that
srcresolves to the intended PNG URL. - Choose a relative path for a file shipped with the site or an absolute URL for a deliberately external resource.
- Write meaningful
alttext, or use an empty value for decoration. - Add intrinsic
widthandheightwhen known. - Use
srcset,sizesorpictureonly when you have a real responsive-image requirement. - Use a data URL only when self-containment justifies larger, less maintainable HTML.
- Test the final deployed URL, not only a source-tree preview.
Frequently asked questions
Is a data URL another image format?
No. It is another way to represent the PNG resource in the src attribute. The media type remains image/png; the data URL specifies how the bytes are written in the document.
Can one PNG be used by several pages?
Yes. A normal file URL can be referenced by every page that can resolve or access that URL. An inline data URL must be repeated in each document that needs its own embedded copy.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Do responsive-image attributes replace src?
No. Keep a usable src fallback even when you add srcset, sizes or a picture element.
Frequently Asked Questions
Is a data URL another image format?
No. It is an alternate representation of PNG bytes in the src attribute; image/png remains the media type.
Can one PNG be used by several pages?
Yes. A normal file URL can be referenced wherever that URL is accessible, while an inline data URL must be repeated in each document.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Do responsive-image attributes replace src?
No. Keep a usable src fallback when using srcset, sizes or picture.
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.




