MDPDFOpen the converter →

Adding images to a Markdown PDF (and why they sometimes vanish)

A practical guide · about 5 min read

Images are one of the most common things people get wrong when converting Markdown to PDF. The image looks fine in the editor, then disappears in the PDF — or shows a broken-image icon. Almost always the cause is the same: the path to the image. This guide explains how image references work and how to make them survive the conversion.

The basic syntax

An image in Markdown looks like a link with a leading exclamation mark:

![a description of the image](path-or-url)

The text in square brackets is the alt text — a description used by screen readers and shown if the image fails to load. The part in parentheses is the important bit: where the image actually lives.

The two kinds of image source

1. A web URL

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

This is the most reliable option for a browser-based converter. As long as your computer is online and the URL is public, the image loads and appears in the PDF. If it doesn't, open the URL directly in a new tab — if it doesn't load there either, the problem is the link, not the converter.

2. A local file path

![Diagram](images/diagram.png)
![Photo](./photo.jpg)

This is where things get tricky. A relative path like images/diagram.png means “a folder called images next to this Markdown file.” That works in your editor because the editor knows where your .md file lives. But when you paste the text into a web converter, the browser has no idea where that folder is — it's just some text, with no file next to it. So local relative paths usually won't render in a paste-based tool.

How to make local images work

You have a few good options:

Controlling image size

Plain Markdown has no syntax for resizing an image — ![alt](x.png) always renders at the image's natural size, which can overflow the page. Two workarounds:

Keeping an image from splitting across pages

A tall image can land right on a page boundary and get cut in half. If your tool lets you add CSS, wrapping the image so it can't break helps:

<img src="tall.png" style="page-break-inside:avoid" alt="...">

More on page behaviour in our guide to page breaks.

A quick checklist when an image is missing

  1. Is it a local relative path pasted into a web tool? Switch to a URL or a data URI.
  2. Is the URL public and loading? Test it in a new browser tab.
  3. Is it just too big and pushed off the edge? Resize it or set a width.
  4. Is the syntax right — leading !, parentheses around the source, no stray spaces?

Get the source right and images are one of the easier parts of a Markdown PDF. When you're ready, paste your document into the converter and check the preview — what you see there is what you'll get in the PDF.

Convert your Markdown

Preview shows exactly what the PDF will contain.

Open the converter