Markdown Image Syntax

Adding images in Markdown is straightforward once you understand how image paths, alt text, and platform support work. Whether you're writing a GitHub README, technical documentation, or personal notes, the same core syntax applies.

This guide shows you how to insert local and remote images, create clickable images, troubleshoot broken image links, and use HTML when you need features that standard Markdown doesn't support.

Open EditorDownload PDF

Basic Markdown Image Syntax

The standard Markdown image syntax works in most Markdown editors, GitHub Flavored Markdown (GFM), documentation sites, and note-taking apps.

![Alt text](image.png)

Example

![Project Logo](images/logo.png)

The image path points to logo.png, while Project Logo becomes the alternative text shown to screen readers and displayed if the image can't be loaded.

How Markdown Image Syntax Works

Element Purpose
! Indicates an image
[] Alt text
() Image path

Unlike a standard Markdown link, image syntax starts with an exclamation mark (!).

πŸ’‘ Pro Tip: Write alt text that describes the image itself, not the filename. Good alt text improves accessibility and makes documentation easier to understand when images fail to load.

Add an Image from a URL

Use a public image URL when the image is hosted online.

![Architecture Diagram](https://example.com/images/architecture.png)

Remote images are commonly used for:

  • Documentation websites
  • Blog posts
  • Knowledge bases
  • Public documentation portals

Keep in mind that if the image is moved or deleted from the remote server, it will no longer appear in your Markdown document.

Add a Local Image

If the image is stored inside your project, reference it with a relative path.

![Project Logo](images/logo.png)

Example project structure

project/
β”œβ”€β”€ README.md
└── images/
    └── logo.png

Using relative paths keeps your documentation portable and ensures images continue working when the project is cloned or shared.

Relative vs Absolute Image Paths

Markdown supports both relative paths and absolute URLs. The right choice depends on where your document will be used.

Relative Path Absolute URL
![Logo](images/logo.png) ![Logo](https://example.com/logo.png)
Uses files inside your project Loads an image from another website
Best for GitHub repositories and documentation Best for externally hosted assets
Continues working when the repository is cloned Depends on the external server remaining available

In most repositories, relative paths are the safer and more reliable option.

Using Images in GitHub

GitHub Flavored Markdown (GFM) fully supports the standard Markdown image syntax.

![Dashboard Screenshot](images/dashboard.png)

For the best experience:

  • Store images inside the same repository.
  • Keep image filenames simple and descriptive.
  • Use relative paths instead of local computer paths.
  • Write meaningful alt text for every image.

πŸ’‘ Pro Tip: GitHub runs on Linux, so filenames are case-sensitive. For example, Logo.png and logo.png are treated as two different files.

Common Image Examples

Use Case Markdown
Repository logo ![Project Logo](images/logo.png)
Application screenshot ![Dashboard](images/dashboard.png)
Remote image ![Architecture](https://example.com/architecture.png)
Documentation diagram ![System Diagram](images/system-diagram.svg)

Clickable Images

Wrap an image inside a Markdown link to make it clickable.

[![Project Logo](images/logo.png)](https://example.com)

This is commonly used for:

  • GitHub README badges
  • Project logos that link to a website
  • Documentation navigation
  • Landing pages

The image becomes the clickable element while the destination URL is defined by the outer Markdown link. For more on link syntax, see the Markdown Links guide.

Add a Title to an Image

Markdown also lets you add an optional title attribute.

![Project Logo](images/logo.png "MDConvertHub")

Many Markdown renderers display the title as a tooltip when someone hovers over the image. Support varies by platform, so it should be treated as an optional enhancement rather than essential content.

Resize Images in Markdown

Standard Markdown does not include a syntax for changing image dimensions.

For example, many parsers ignore this syntax:

![Logo](logo.png){width=250}

Some Markdown flavors support custom attributes, but GitHub Flavored Markdown (GFM) and many popular Markdown editors do not. If you need consistent control over image size, use HTML instead.

Resize Images with HTML

Most Markdown applications allow inline HTML.

<img src="logo.png" alt="Project Logo" width="250">

You can also specify additional attributes when your platform supports them.

Attribute Purpose
width Sets the image width.
height Sets the image height.
loading="lazy" Delays loading until the image is needed.
style Applies custom CSS when inline styles are allowed.

πŸ’‘ Pro Tip: GitHub supports basic HTML inside Markdown, but some platforms remove or restrict HTML for security reasons. Always preview your document before publishing. See HTML in Markdown for more details.

Supported Image Formats

Most Markdown renderers support common web image formats.

Format Best For
PNG Screenshots, UI elements, transparent graphics
JPG / JPEG Photographs
SVG Logos, icons, diagrams
GIF Simple animations
WebP Optimized web images with smaller file sizes

Support depends on the Markdown renderer rather than Markdown itself. If a browser can display the image and the platform allows it, Markdown can usually reference it.

Platform Compatibility

Markdown image support varies slightly across platforms, especially when HTML or custom attributes are involved.

Platform Standard Images HTML <img> Image Resizing
GitHub (GFM) βœ… βœ… Basic βœ… HTML only
GitLab βœ… βœ… βœ… HTML only
Obsidian βœ… βœ… Varies by theme/plugins
VS Code Preview βœ… βœ… βœ… HTML
Docusaurus βœ… βœ… βœ… HTML
Notion Partial ❌ Limited
Reddit Limited ❌ ❌
Discord Preview only ❌ ❌

Choosing the Right Approach

Goal Recommended Method
Add an image stored in your project Relative path
Display an externally hosted image Public image URL
Make an image clickable Wrap the image inside a Markdown link
Control image dimensions HTML <img>
Display a logo or icon SVG
Add screenshots to documentation PNG
Publish photographs JPG or WebP

Troubleshooting Markdown Images

If an image doesn't appear, the problem is usually the file path, filename, or platformβ€”not the Markdown syntax itself. Work through these checks before changing your document.

Why Isn't My Image Showing?#

Problem Possible Cause How to Fix
Broken image icon Incorrect file path Verify the folder structure and relative path.
Image works locally but not on GitHub Image wasn't committed to the repository Add the image to your repository and push the changes.
Image loads on one platform but not another HTML or custom syntax isn't supported Use standard Markdown image syntax whenever possible.
Remote image doesn't load URL is invalid or the file was removed Open the image URL directly in your browser to verify it's still available.
Image suddenly disappears File was renamed or moved Update the image path to match the new location.

Check Your Image Path#

Most broken images are caused by an incorrect path.

Suppose your project looks like this:

project/
β”œβ”€β”€ README.md
└── images/
    └── logo.png

The correct Markdown is:

![Project Logo](images/logo.png)

A missing folder name or incorrect directory level is enough to prevent the image from rendering.

Watch for Filename Differences#

Many hosting platforms, including GitHub, use case-sensitive file systems.

For example, these filenames are not the same:

Logo.png
logo.png

If your Markdown references logo.png but the repository contains Logo.png, the image won't load.

πŸ’‘ Pro Tip: Copy the filename directly from your file explorer or repository instead of typing it manually. This helps avoid case and spelling mistakes.

Local Paths vs Public URLs#

A local computer path only works on your own device.

Avoid

C:\Users\John\Pictures\logo.png

Use a relative path instead

![Logo](images/logo.png)

Or use a public image URL if the image is hosted online.

Images with Spaces in Filenames#

Although spaces can work, they often make links harder to read and maintain.

Instead of:

Project Logo Final.png

Prefer:

project-logo.png

Simple, lowercase filenames with hyphens are easier to reference and reduce the chance of mistakes across different tools and operating systems.

Best Practices

Following a few consistent habits will make your Markdown documents easier to maintain and more portable.

  • Write descriptive alt text instead of generic labels like "image".
  • Keep images inside your project whenever possible.
  • Use relative paths for repositories and documentation.
  • Compress large images before publishing.
  • Choose clear, descriptive filenames.
  • Preview your document after moving or renaming files.
  • Use HTML only when you need features that standard Markdown doesn't provide.

Common Use Cases

Task Recommended Approach
Add a logo to a GitHub README Store the logo in the repository and use a relative path.
Insert screenshots into documentation Save screenshots in an images folder and reference them relatively.
Display diagrams hosted online Use a public HTTPS image URL.
Create a clickable project logo Wrap the image inside a Markdown link.
Resize an image consistently Use an HTML <img> tag if your platform supports it.

Before You Publish

A quick review can prevent most image-related issues.

  • βœ“ Every image renders correctly.
  • βœ“ Alt text describes the image.
  • βœ“ File paths are correct.
  • βœ“ Filenames match exactly.
  • βœ“ Large images are optimized.
  • βœ“ Remote URLs are publicly accessible.
  • βœ“ HTML has been tested on the target platform.

Final Note

Markdown image syntax is intentionally simple, but reliable image rendering depends on using the correct file paths, meaningful alt text, and features supported by your Markdown platform. By following the examples and best practices in this guide, you can add images that work consistently across GitHub repositories, documentation sites, note-taking apps, and other Markdown editors.

Frequently Asked Questions

  1. 1

    How do I add an image in Markdown?

    Use the standard Markdown image syntax with either a relative file path or a public image URL. ``markdown ![Alt text](image.png) `` For project documentation and GitHub repositories, relative paths are usually the better choice because they continue working when the project is cloned or moved.

  2. 2

    Can I use an image from a website?

    Yes. Replace the file path with the public URL of the image. ``markdown ![Architecture Diagram](https://example.com/diagram.png) `` The image must remain publicly accessible. If it's removed or the URL changes, it will no longer appear in your Markdown document.

  3. 3

    Can I resize images in Markdown?

    Standard Markdown doesn't support image resizing. If your Markdown platform allows inline HTML, you can control image dimensions with the <img> tag. ``html <img src="logo.png" alt="Project Logo" width="250"> `` Support varies between Markdown editors and publishing platforms.

  4. 4

    Why does my image work locally but not on GitHub?

    This usually happens because: - The image wasn't committed to the repository. - The filename doesn't match exactly. - The image path is incorrect. - The file was moved or renamed. GitHub also treats filenames as case-sensitive, so Logo.png and logo.png are different files.

  5. 5

    Should I use relative or absolute image paths?

    Use relative paths for images stored in your project and absolute URLs for images hosted elsewhere. Relative paths make repositories easier to share because the links continue working after cloning or downloading the project.

  6. 6

    Which image formats work in Markdown?

    Most Markdown renderers support common web image formats, including PNG, JPG, JPEG, GIF, SVG, and WebP. Actual support depends on the platform rendering the Markdown rather than the Markdown syntax itself.

  7. 7

    Can I make an image clickable?

    Yes. Wrap the image inside a standard Markdown link. ``markdown [![Project Logo](images/logo.png)](https://example.com) `` This pattern is commonly used for project logos, documentation banners, and GitHub README badges.

  8. 8

    Does GitHub support Markdown images?

    Yes. GitHub Flavored Markdown (GFM) supports the standard Markdown image syntax in README files, documentation, Wikis, Issues, and Pull Requests. Basic inline HTML is also supported in many cases, making it possible to resize images with the <img> tag.