Images in Markdown
An image is a link with an exclamation mark in front: . This guide covers titles, sizes, captions, reference-style images and the extra syntax some apps add.
Quick answer
How do you insert an image in Markdown?
Write an exclamation mark, the alt text in square brackets and the image address in parentheses: . The address can be a URL or a path relative to the Markdown file. Markdown cannot set the size; use an HTML <img> tag with width for that.
Result
Image syntax and examples
The examples use a small picture from this site; replace the address with your own image.
Image with a title
Text in quotes after the address becomes the image's title, shown on hover.
Result
Setting the size with HTML
Markdown has no size syntax. An <img> tag with width sets the width, and the height follows.
<img src="/samples/landscape.svg" alt="Green hills under a blue sky" width="240">Result
Reference-style images
Like reference links, the address can live elsewhere in the document under a label.
![Green hills under a blue sky][hills]
[hills]: /samples/landscape.svgResult
Image with a caption
Markdown has no caption syntax. Where HTML is allowed, use <figure> and <figcaption>.
<figure>
<img src="/samples/landscape.svg" alt="Green hills under a blue sky" width="300">
<figcaption>Hills in spring.</figcaption>
</figure>Result
Obsidian: width after a pipe
Obsidian sets the width with a number after | in the alt text, or after the file name of an embedded image.

![[hills.png|200]]Obsidian only. Other Markdown apps display this differently, so there is no preview.
Pandoc: size in braces
Pandoc reads width and height from braces after the image, in pixels, centimeters or percent.
{width=50%}Pandoc only. Other Markdown apps display this differently, so there is no preview.
Images in popular apps
 works wherever Markdown files are rendered. Sizing and chat apps differ.
| App | Support | Notes |
|---|---|---|
| GitHub / GitLab | Supported | Images and <img> with width; relative paths point into the repository. GitHub also shows <picture> dark-mode images. |
| Obsidian | Supported | Images and embeds; |300 sets the width. |
| VS Code / Typora | Supported | Images and <img> sizing work in the preview. |
| Discord / Slack | Not supported | No image syntax; upload the image or paste its URL. |
Questions and answers
How do I resize an image in Markdown?
<img src="image.png" alt="…" width="300">. Obsidian accepts , and Pandoc {width=300px}.How do I center an image?
<p align="center"><img src="image.png" alt="…" width="300"></p>. GitHub keeps the align attribute but removes style.Why is my image not showing?
%20 or angle brackets around the address. The ! must sit right before the [.What is the alt text for?
How do I add an image from my computer?
. On GitHub you can also drag an image into an issue or comment to upload it.How do I show a different image in dark mode on GitHub?
<picture> element with <source media="(prefers-color-scheme: dark)" srcset="dark.png"> and an <img> for light mode inside it.How do I add a caption?
<figure> and <figcaption> where HTML is allowed.