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

When a PNG does not appear in an HTML <img>, the file extension is only a clue. The browser must resolve the exact URL, receive a successful response with image data, accept the response’s MIME type, choose the intended responsive-image candidate, pass any cross-origin checks, and decode a valid PNG. Work through those layers in that order; the first failing layer usually identifies the fix.

1. Verify the URL, filename, and deployed file

Start with the simplest possible element:

<img src="images/photo.png" alt="Description of the image">

Check every part of the path against the files actually served by your site.

  • Filename: Correct spelling, punctuation, and extension. photo.png and Photo.png are different paths on case-sensitive servers.
  • Directory: A relative URL is resolved from the page URL, not necessarily from your project root. If the page is /gallery/index.html, images/photo.png normally means /gallery/images/photo.png.
  • Deployment: Confirm that the image was uploaded or copied into the directory your web server publishes. A file that exists on your laptop but not in the deployed build cannot load in production.
  • URL syntax: Encode spaces and special characters, or use a filename without them. Check that your build system has not rewritten the asset path.

Open the exact image URL in a new browser tab. If it returns a 404, an application error, a login page, or a blank response, fix hosting, routing, or deployment before changing the HTML. A visible .png suffix does not prove that the response contains PNG bytes.

Absolute and root-relative paths

Use a path that matches your deployment layout:

<!-- Relative to the current page URL -->
<img src="images/photo.png" alt="Product photo">

<!-- From the site origin's root -->
<img src="/images/photo.png" alt="Product photo">

<!-- A complete remote URL -->
<img src="https://cdn.example.com/photo.png" alt="Product photo">

Do not use a filesystem path such as C:siteimagesphoto.png or /Users/name/site/images/photo.png; browsers request web URLs, not your local disk.

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.
#1 Best Overall
Imagd - Heic to Jpeg, Png Image Converter
  • 🖼️ A simple app that "just works".
  • 🖼️ No loss in details or image quality.
  • 🖼️ No more annoying ads or confusing user interface.
  • 🖼️ Convert an unlimited number of images for free at no hidden cost.
  • 🖼️ Click on the Add Images button at the bottom-right corner.

2. Inspect the actual image request

Developer tools reveal what the browser requested rather than what you intended to request.

  1. Open the browser’s developer tools and select Network.
  2. Reload the page. Enable “preserve log” if navigation removes the request.
  3. Filter by Img (or search for the filename).
  4. Open the image request and verify the requested URL, status, response headers, and response preview or body.

A 200 status means the server completed the HTTP request; it does not guarantee that the body is a decodable image. A 304 indicates that the browser is using a validated cached copy. A 404 points to a missing or misrouted resource, while a 403 commonly indicates permission or hotlink protection. Redirects, authentication pages, server errors, and network failures can also return something other than an image.

Copy the requested URL from Network and open it directly. Compare the response body with the asset you expect. If the request is never present, inspect the element, CSS, JavaScript, or content-security policy that may prevent the browser from creating it.

3. Confirm the response MIME type

For a PNG, the response should include:

Content-Type: image/png

Browsers use media-type information and the returned bytes, not merely the filename extension, when deciding how to decode a resource. A server that returns text/html may actually be sending a 404 page or an application shell at a URL ending in .png. A generic binary type can also indicate incomplete server configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Image Converter - JPG, PNG, PDF, WEBP, GIF, HEIC
  • Convert pictures in to batch mode and export jpeg, png, jpg or other image format
  • Photo size converter helps to compress and resize pictures in high quality
  • Jpeg converter easily converters multiple pictures in to other image format
  • Share images by reducing and compressing the image sizes by maintain quality
  • Choose compress level and reduce the image size to easily share pictures

Inspect Response Headers in Network. Correct the web server, CDN, object-storage metadata, or application route that serves the file. The exact configuration depends on your hosting platform, but the goal is the same: the URL must return the PNG itself with image/png.

Do not “fix” this by changing only the extension in HTML. If the bytes are HTML, renaming the URL cannot turn them into an image.

4. Check srcset and sizes before debugging the fallback

Responsive images can make the visible request differ from the URL in src:

<img
  src="images/photo.png"
  srcset="images/photo-480.png 480w, images/photo-1200.png 1200w"
  sizes="(max-width: 600px) 100vw, 600px"
  alt="Product photo">

When width descriptors such as 480w and 1200w are present, supporting browsers choose a candidate using srcset and sizes; they do not necessarily display src. Inspect the request that actually failed or is displayed. A stale generated filename, wrong case, missing upload, or incorrect CDN path in one candidate can break the image even though the fallback looks correct.

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.
Rank #3
JPG TO PNG IMAGE CONVERTER
  • - Save into Gallery all converted images
  • - Easy to share, delete converted JPG, JPEG and PNG images
  • - Choose image output format (jpeg, png, jpg).
  • - You can share directly from the view images in converted images and from converted gallery as well.
  • - JPG to PNG and PNG to JPG converter

Practical responsive-image checks

  • Test at several viewport widths and device-pixel ratios.
  • Verify every URL listed in srcset, not just the first one.
  • Ensure each width descriptor matches the intrinsic width of its file closely enough for your intended selection.
  • Use Network’s “initiator” or the element inspector to identify the selected candidate.
  • Temporarily remove srcset and sizes to isolate a candidate-selection problem; restore them after correcting the URLs.

5. Diagnose cross-origin and crossorigin behavior

An image hosted on another origin can normally be displayed, but adding a crossorigin attribute changes the request into a CORS request. The remote server must then grant permission to your page’s origin.

<img src="https://cdn.example.com/photo.png" alt="Product photo" crossorigin="anonymous">

If the server does not return an appropriate Access-Control-Allow-Origin response, the browser reports a CORS error and blocks the request for that use. Check the Console and the image request’s response headers.

Remove crossorigin when you do not need to reuse the pixels in canvas or another API that requires a non-tainted image. If you do need it, configure the image host to allow the requesting origin (or an appropriate allowed-origin policy) and ensure any credentials mode matches the server’s CORS configuration. Adding the attribute casually is a common way to turn a displayable remote image into a blocked request.

6. Validate that the file is really a PNG

A damaged file or a file renamed with a .png extension cannot be decoded reliably. Replace or re-export the asset if an image viewer, editor, or trusted image utility cannot open it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Image To PDF Converter, png jpg to pdf converter
  • Key Features
  • Convert jpg to PDF
  • Convert jpeg to PDF
  • Convert PNG to PDF
  • Convert all images to PDF

PNG files begin with the signature bytes 89 50 4E 47. You rarely need to inspect bytes manually, but the signature explains why a suffix is not proof of format. Check that:

  • The downloaded response is the expected file, not an HTML error document.
  • The file opens in an image viewer and can be re-saved as PNG.
  • The upload or build process did not truncate, compress incorrectly, or substitute another format.
  • The server is not applying a transformation that produces invalid output.

If replacing the file fixes the problem, preserve the corrected asset and investigate the upload, optimization, or deployment step that damaged the original.

7. Use meaningful alternative text while you debug

Write alternative text that conveys the image’s information:

<img src="images/chart.png" alt="Bar chart showing sales rising from January through June">

For a purely decorative image, use alt="". Empty alternative text tells assistive technology to ignore the image, but it can also make a failed decorative image less obvious visually in some browsers. Do not leave out alt: loading failures should not remove essential information from users who cannot see the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Pixillion Image Converter Software for Mac- Convert Photo and Image File Formats [Download]
  • Convert images to jpeg, gif, png, bmp, tiff and more
  • Rotate, resize and compress digital photos
  • Easily add captions or watermarks to your images
  • Compress thousands of photos at a time with batch conversion
  • Convert images directly from the right-click menu
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

8. A complete diagnostic decision path

Evidence Likely layer Next action
No image request in Network HTML, CSS, JavaScript, or policy Inspect the rendered element, computed attributes, and console errors.
404 or wrong requested URL Path, spelling, case, routing, or deployment Correct the URL and publish the file at that exact location.
200/304 but response is HTML Server route, authentication, or error handling Fix the route and verify the body is image data.
Wrong Content-Type Server, CDN, or object metadata Serve the PNG as image/png.
Request differs from src srcset/sizes Fix the selected candidate URL or its deployment.
Console reports CORS Cross-origin request Remove unnecessary crossorigin or configure the remote origin.
Correct URL and headers, decode failure Corrupt or mislabeled asset Replace or re-export a valid PNG.

9. Or skip the browser setup

For automated checks, reports, or repeatable captures, ScreenshotNeo can fetch a page and return a screenshot through one request. Its capture process accepts cookie-consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing result. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Use the API key from your account and replace the example URL with the page you need to inspect. Full parameter details are in the ScreenshotNeo documentation.

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)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));

The service includes full-page captures with lazy images loaded, CSS-selector element capture, custom CSS and JavaScript, waits for selectors, delays, or network idle, request and resource blocking, custom headers and cookies, viewport and device presets, retina scale, dark mode, PDF output, caching with a chosen TTL, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameters commonly used by other screenshot APIs also work, which can simplify migration.

The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 screenshots; Growth is $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing provides two months free, and every feature is available on every plan. Sign up for the free plan to test a page without adding a card.

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

10. Prevent the same failure in future deployments

  • Keep asset names lowercase and avoid spaces.
  • Run a link or asset check against the production build, not only the source tree.
  • Inspect representative image requests after each CDN, routing, or optimization change.
  • Test responsive candidates at mobile and desktop widths.
  • Record the expected MIME type and verify it in deployment checks.
  • Keep original image files so a damaged optimized derivative can be regenerated.
  • Use descriptive alt text as part of the component contract.

Frequently Asked Questions

Does changing .jpg to .png repair a broken image?

No. The response must contain valid PNG data and normally be served as image/png; changing the URL suffix does not convert the bytes.

Why does the image work locally but not after publishing?

The deployed site may be missing the file, using different capitalization or directory paths, or serving a different response. Check the production URL and its Network request.

Is CORS required for every remote image?

No. Displaying a remote image usually does not require the crossorigin attribute. That attribute is needed only for specific cross-origin uses and requires permission from the image server.

What should I check when src is correct but the wrong image appears?

Inspect srcset and sizes. A browser may have selected another candidate URL.

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

Quick Recap

Bestseller No. 1
Imagd - Heic to Jpeg, Png Image Converter
Imagd - Heic to Jpeg, Png Image Converter
🖼️ A simple app that "just works".; 🖼️ No loss in details or image quality.; 🖼️ No more annoying ads or confusing user interface.
Bestseller No. 2
Image Converter - JPG, PNG, PDF, WEBP, GIF, HEIC
Image Converter - JPG, PNG, PDF, WEBP, GIF, HEIC
Convert pictures in to batch mode and export jpeg, png, jpg or other image format; Photo size converter helps to compress and resize pictures in high quality
Bestseller No. 3
JPG TO PNG IMAGE CONVERTER
JPG TO PNG IMAGE CONVERTER
- Save into Gallery all converted images; - Easy to share, delete converted JPG, JPEG and PNG images
$30.00
Bestseller No. 4
Image To PDF Converter, png jpg to pdf converter
Image To PDF Converter, png jpg to pdf converter
Key Features; Convert jpg to PDF; Convert jpeg to PDF; Convert PNG to PDF; Convert all images to PDF
Bestseller No. 5
Pixillion Image Converter Software for Mac- Convert Photo and Image File Formats [Download]
Pixillion Image Converter Software for Mac- Convert Photo and Image File Formats [Download]
Convert images to jpeg, gif, png, bmp, tiff and more; Rotate, resize and compress digital photos
$39.99

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.