Markdown images
The image syntax is one character away from the link syntax, and that character changes almost everything about how the brackets behave. Here is the full picture, including the limits.
Updated September 2026
The syntax
An exclamation mark, then the alt text in square brackets, then the source in round brackets. That is the whole of it. Unlike a link, the bracketed text is never displayed when the image loads — it is the alt attribute, read by screen readers and shown when the image fails.
The source can be a full URL, a path relative to the current document, or a site-absolute path starting with a slash. An image sits in its own paragraph if you leave blank lines around it, or flows inline with text if you do not — there is no syntax for floating it left or right.
You type

Inline  in a sentence.You get

Inline
in a sentence.
Alt text is not a caption
Alt text describes what the image conveys, for someone who cannot see it. "Screenshot" tells them nothing. "The settings panel with two-factor authentication switched on" tells them what they are missing. Keep it to a sentence.
If the image is purely decorative — a divider, a spacer, an icon repeating a word next to it — leave the brackets empty. An empty alt tells assistive software to skip it, which is better than making it announce a filename. Never start with "Image of"; the software already says that. And do not put the caption in the alt text: a visible caption belongs in a paragraph below, where everyone can read it.
You type


*Figure 1: quarterly revenue.*You get


Figure 1: quarterly revenue.
Titles and reference-style images
A quoted string after the source becomes the title attribute, shown as a tooltip on hover. It is supplementary — invisible on touch devices and not a replacement for alt text.
Images also take the reference form that links do: define the source once with a label, then refer to it by that label. This is worth doing for a badge or logo you repeat, and for keeping a paragraph readable when the URL is long. The definitions can live anywhere in the file, usually at the bottom, and never render.
You type
![Build status][badge]

[badge]: https://img.shields.io/badge/build-passing-greenYou get

Making an image clickable
Wrap the whole image in link brackets. The image expression takes the place of link text, so you get an opening square bracket, then the full image syntax, then the closing bracket and the URL. It reads awkwardly the first time and is correct.
This is how README badges work: the badge image links to the build, and a thumbnail links to the full-size file. Note the nesting order — the exclamation mark stays with the inner brackets. Getting it backwards produces literal text instead.
Size: the honest answer
Standard Markdown has no syntax for width, height, alignment or captions. The image renders at its natural size, constrained by the container's stylesheet. This is deliberate — Markdown describes content, not layout.
There are three practical routes. Resize the file itself before you commit it, which is the only approach that works everywhere and keeps the page light as a bonus. Use raw HTML where the platform allows it: GitHub accepts an <img> tag with a width attribute in a README. Or rely on a flavor-specific extension — Obsidian and some others accept , and a few parsers accept =400x after the source. None of these are portable.
This viewer disables raw HTML entirely, so an <img> tag pasted here appears as literal text rather than an image. The example below shows exactly that.
You type
<img src="/ui/dash.png" width="400" alt="The dashboard">You get
<img src="/ui/dash.png" width="400" alt="The dashboard">
Raw HTML is disabled in this viewer, so the tag is shown as text. On GitHub it would render at 400px wide.
Paths: what resolves where
A relative path resolves against the location of the document being rendered, not against where you wrote it. That is why an image that works in your editor breaks on the published site: the file moved one folder deeper, and images/logo.png now points somewhere that does not exist.
Three rules keep this manageable. Keep images in one folder near the document and use short relative paths. Use a leading slash only when you know what the site root is. And remember that a viewer reading a single pasted file — this one included — has no folder to resolve against, so local relative paths cannot load and only full URLs will. Case matters on most servers even though it does not on Windows or macOS.
Images in a GitHub README
GitHub serves images from the repository, so a relative path to a committed file is the most reliable form: it survives forks and does not break when someone clones the repo. Avoid pasting a blob URL copied from the address bar — that is the HTML page around the file, not the file, and it will not display. The raw form on raw.githubusercontent.com works but pins you to a branch name.
Two GitHub-specific extras. Dragging a file into an issue or the README editor uploads it and inserts a permanent attachment URL. And GitHub supports a <picture> element with prefers-color-scheme, so a logo can differ between light and dark mode — raw HTML again, so it works there and not in stricter renderers. Badges are ordinary images from a service such as Shields.io, usually wrapped in a link as shown above.
Why isn't my image showing?
In rough order of frequency:
- The path is wrong. Check it relative to the rendered file, not the source file, and check the letter case.
- A space in the filename. Encode it as
%20, or wrap the source in angle brackets. - The exclamation mark is missing, so you have written a link instead of an image.
- A space between the square and round brackets, which breaks the syntax and leaves literal brackets on the page.
- A GitHub
blobURL instead of a raw or relative path. - The renderer blocks remote images, or the host blocks hotlinking.
- Raw HTML is disabled, as it is here, so an
<img>tag will never display.
One quick diagnostic: if the alt text appears where the image should be, the syntax is right and the file is the problem. If the brackets themselves appear, the syntax is. The links guide covers the bracket rules, which are shared.
Frequently asked questions
How do I insert an image in Markdown?
Write an exclamation mark, the alt text in square brackets, then the path or URL in round brackets. The exclamation mark is what makes it an image rather than a link.
How do I resize an image in Markdown?
Standard Markdown cannot. Resize the file itself, or use an HTML img tag with a width attribute where the platform allows raw HTML, such as a GitHub README.
How do I make an image a link?
Wrap the image in link brackets, so the image syntax sits where the link text would go. This is how README badges link through to a build or a package page.
What should I write as alt text?
What the image shows, in one sentence, for someone who cannot see it. Leave the brackets empty for purely decorative images so screen readers skip them.
Why does my image show as a broken icon?
The syntax parsed but the file did not load: usually a wrong relative path, a case mismatch, an unencoded space, or a GitHub blob link instead of a raw one.
Can I add a caption under an image in Markdown?
There is no caption syntax. Put an italic line in the paragraph directly below the image; that is the convention most documents settle on.
Paste the document and watch which sources resolve as you edit them.