Back to Top Guides
Beginner Guides

Fix Markdown Images That Do Not Show in Preview

Test the image reference, identify missing repository context, and replace inaccessible paths before publishing or export.

By MD Opener3 min readPublished Updated

A broken Markdown image is usually not a Markdown rendering problem. It is a resource-location problem: the renderer understands the image syntax but cannot retrieve the referenced file.

Inspect unfamiliar image URLs in the source first, because previewing can contact their hosts. Then open an appropriate test copy in the Markdown viewer and use this checklist.

Confirm the syntax

![System architecture](https://example.com/images/system.png)

The example URL illustrates syntax and is not a supplied image. Replace it with a real permitted resource. Do not omit the exclamation mark, closing bracket, or parentheses. Alt text should describe the information in the image so the document remains meaningful if loading fails.

Test the image address directly

Copy an absolute image URL into a browser tab. If it does not load there, check access before blaming Markdown syntax. Successful direct loading still does not guarantee that a host permits embedding or export access. Check for a removed file, expired token, login requirement, or access restriction.

Use the symptom to choose the next check:

What you see Likely area to inspect
Alt text or a broken-image icon URL, filename, permissions, or network response
Literal ![alt](url) text Markdown syntax or an unsupported renderer
Image works in a repository but not in a standalone viewer Missing repository path context
Image works in preview but not in an export Host access rules or the export capture step

Change one variable at a time. Replacing both the filename and the host at once may make the image appear without showing which part was wrong.

Understand relative paths

./images/demo.png means “find this file relative to the current document.” GitHub and local editors know the repository structure. A standalone online viewer normally receives only the Markdown file, so the adjacent image is absent.

For a portable document, replace the relative path with a reachable absolute URL. For private material, consider whether hosting the image externally is acceptable before changing the source.

Check casing and encoded characters

Verify uppercase and lowercase letters, spaces, parentheses, and special characters in filenames. Renaming Product Screenshot (1).png to a simpler filename such as product-screenshot.png reduces escaping and deployment problems.

Compare the path with its rendering context

The same path can mean different things in different locations:

  • ./images/chart.png starts from the Markdown document's directory.
  • ../images/chart.png moves up one directory before looking for the asset.
  • /images/chart.png starts at the website root when used on a site.
  • https://docs.example.com/images/chart.png names a complete remote address.

Write down where the Markdown will ultimately live before choosing among them. A path that is correct in a repository README can be wrong in a documentation site with a different publishing root. A root-relative website path also has no useful meaning when someone opens a lone .md file outside that site.

If you control the destination, inspect its generated page URL and asset folder rather than guessing how it resolves paths. If you do not control it, use the destination's documented image rules.

Make a minimal reproduction

Copy one failing image line into a new document and add a heading above it. Remove surrounding HTML, reference definitions, and nested list indentation. If the image now works, add the surrounding syntax back in small pieces. This exposes problems such as an unclosed code fence that causes otherwise valid image syntax to display as code.

Do this with a non-sensitive test asset. Opening an unknown remote image URL can reveal normal connection information to that host.

Verify the repair in the destination

Restore the repaired line to its original document and test it where readers will encounter it. Repository hosts, documentation generators, and standalone viewers do not necessarily resolve the same address from the same base location.

If the destination is an exported file, complete that workflow only after the browser rendering is stable. The PDF image guide covers pagination and output inspection; those are separate from identifying the broken reference.

Key takeaways

  • Verify Markdown image syntax and filename casing
  • Distinguish relative-path problems from network problems
  • Use a browser preview to confirm the fix

Frequently asked questions

Why does a Markdown image work on GitHub but not in an online viewer?

GitHub resolves relative paths against the repository. A standalone viewer receives only the Markdown file and may not have access to nearby assets.

Are image filenames case-sensitive?

They can be. A reference to `Diagram.png` may fail when the actual file is named `diagram.png`, especially after deployment to a case-sensitive server.

What image syntax should I use?

Use `![descriptive alt text](image-url)` and ensure that the URL or path is valid in the environment where the Markdown will be rendered.

Beginner Guides

More from Beginner Guides

View category page

Other guide clusters

Discover related Markdown use cases

Browse all guides