How to Add Images in Markdown: Complete Guide
Learn how to insert images in Markdown documents. Covers basic syntax, sizing, alignment, captions, and hosting options.
Try it yourself
Use our free image hosting tool to do this instantly — no signup required.
Image HostingAdding images to Markdown is straightforward. Here's everything you need to know, from basic syntax to advanced techniques.
Basic Image Syntax

Example:

Components:
!- Indicates an image (vs a link)[Alt text]- Description shown if image doesn't load(url)- Path to the image
Image with Title (Tooltip)
Add a title that shows on hover:

Example:

Local vs Remote Images
Local Images (Relative Path)


Remote Images (URL)

Hosted Images
For reliable image hosting, use LinkyHost Free Image Hosting:
- Upload your image
- Get a permanent URL
- Use in your Markdown
Reference-Style Images
For cleaner documents with multiple images:
![First image][img1]
![Second image][img2]
[img1]: https://example.com/image1.jpg
[img2]: https://example.com/image2.jpg "Optional title"
This keeps your content readable while defining image URLs elsewhere.
Image Sizing
Standard Markdown doesn't support sizing, but there are workarounds:
HTML Method (Most Compatible)
<img src="image.jpg" alt="Description" width="500">
Or with height:
<img src="image.jpg" alt="Description" width="500" height="300">
Platform-Specific Syntax
GitHub/GitLab:

<!-- No native sizing - use HTML -->
Obsidian:
![[image.jpg|500]]
Some processors:
{width=500px}
Image Alignment
Center with HTML
<p align="center">
<img src="image.jpg" alt="Centered image" width="400">
</p>
Left/Right Alignment
<img align="right" src="image.jpg" width="200">
This text wraps around the image on the right.
Images as Links
Make an image clickable:
[](https://destination-url.com)
Example:
[](https://linkyhost.com)
Adding Captions
Standard Markdown doesn't support captions, but you can:
Method 1: Italic Text Below

*A beautiful sunset over the ocean*
Method 2: HTML Figure
<figure>
<img src="sunset.jpg" alt="Sunset">
<figcaption>A beautiful sunset over the ocean</figcaption>
</figure>
Method 3: Table
|  |
|:--:|
| *A beautiful sunset* |
Platform-Specific Features
GitHub
<!-- Supported -->

<img src="url" width="500">
<!-- Drag and drop uploads -->
<!-- Paste from clipboard -->
Obsidian
![[image.png]] <!-- Internal link -->
![[image.png|500]] <!-- With width -->
![[image.png|500x300]] <!-- With dimensions -->
GitLab

{width=500} <!-- Sometimes supported -->
Jekyll/Hugo

Image Formats
| Format | Best For | Transparency |
|---|---|---|
| JPG | Photos | No |
| PNG | Graphics, screenshots | Yes |
| GIF | Animations | Yes |
| SVG | Icons, logos | Yes |
| WebP | Modern web (smaller) | Yes |
Organizing Images
Folder Structure
project/
├── README.md
├── docs/
│ └── guide.md
└── images/
├── logo.png
├── screenshots/
│ ├── step1.png
│ └── step2.png
└── diagrams/
└── flowchart.svg
Naming Convention
✅ Good:
screenshot-login-page.png
diagram-user-flow.svg
photo-team-2024.jpg
❌ Bad:
IMG_1234.jpg
Screenshot 2024-01-15.png
untitled.png
Common Issues
Image Not Showing
Check:
- File path is correct (case-sensitive on some systems)
- File exists at that location
- URL is accessible (not behind auth)
- Image format is supported
Broken Image on GitHub
Common causes:
- Using absolute local paths (
C:\Users\...) - Missing file in repository
- Incorrect relative path
Solution:
<!-- Use relative paths from the markdown file -->

Image Too Large
Solutions:
- Resize before uploading
- Use HTML width attribute
- Compress with tools like TinyPNG
Image Hosting Options
For GitHub Projects
- Store in repository
/imagesfolder - Use GitHub's issue image upload trick
- Upload to LinkyHost
For Documentation
- LinkyHost Free Image Hosting
- Imgur (may have reliability issues)
- Cloudinary (has free tier)
For Static Sites
- Store in
/staticor/assetsfolder - Use site's asset pipeline
- CDN for larger images
Accessibility Best Practices
Write Good Alt Text
❌ Bad:


✅ Good:


Decorative Images
For purely decorative images, use empty alt:
<img src="decoration.png" alt="">
Quick Reference
Basic image:

With title:

As link:
[](https://link.com)
With size (HTML):
<img src="url" alt="text" width="500">
Centered:
<p align="center">
<img src="url" alt="text">
</p>
Reference style:
![Alt][ref]
[ref]: url "title"
FAQ
Can I use base64 encoded images?
Yes, but it makes your Markdown huge and hard to read:

Not recommended for most use cases.
How do I add images in GitHub comments?
Drag and drop, or paste from clipboard. GitHub uploads automatically.
Why doesn't my image resize work?
Standard Markdown doesn't support sizing. Use HTML <img> tags instead.
Can I use SVG images?
Yes, SVG works in most Markdown processors. Some may require HTML:
<img src="diagram.svg" alt="Diagram">
Summary
Basic syntax: 
For sizing: Use HTML <img> tags
Best practices:
- Use descriptive alt text
- Organize images in folders
- Use relative paths for portability
- Host images reliably with LinkyHost