Markdown Images to Word: Embedding, Sizing & Format Guide

A comprehensive guide to converting Markdown documents containing images into professional Word files. Learn how to handle local images, remote URLs, sizing, alignment, captions, and figure numbering so your documents look polished every time.

Updated: March 2026 12 min read

Images are arguably the trickiest part of any Markdown-to-Word conversion. While headings, paragraphs, and even tables translate relatively smoothly, images introduce a host of complications: broken file paths, oversized photos that spill off the page, missing alt text, unsupported formats, and the complete absence of captions or figure numbering in standard Markdown syntax.

The challenge is compounded by the fact that Markdown was designed for the web, where images are referenced by URL and rendered by browsers that handle resizing automatically. Word, on the other hand, embeds images as binary blobs inside the .docx container and expects explicit dimensions, positioning, and text-wrapping settings. Bridging this gap requires understanding both ecosystems.

This guide walks you through every step of the process—from writing image-rich Markdown to producing a Word document where every figure is properly sized, aligned, captioned, and numbered. Whether you are writing technical documentation, academic papers, or business reports, you will find actionable techniques that work with online converters, Pandoc, and manual workflows alike.

Markdown Image Syntax

Before diving into conversion issues, let us review the fundamental Markdown syntax for images. Understanding every part of the image declaration will help you diagnose problems later and write Markdown that converts cleanly to Word.

Basic Image Syntax

The standard Markdown image syntax follows this pattern:

![Alt text](path/to/image.png "Optional title")

Each component serves a specific purpose in both web rendering and Word conversion:

  • Alt text — Displayed when the image cannot be loaded. In Word, this becomes the image's alternative text property, which is important for accessibility and screen readers. Never leave this empty.
  • Path — Can be a relative file path (./images/diagram.png), an absolute path (/home/user/docs/figure1.jpg), or a full URL (https://example.com/photo.png).
  • Title — The optional quoted string after the path. Browsers show this as a tooltip on hover. In Word, it is typically ignored by most converters, but Pandoc can map it to a caption.

Relative vs. Absolute Paths

The type of path you use has a direct impact on whether your images survive the conversion process:

# Relative path (recommended for local projects)
![Architecture diagram](./images/architecture.png)

# Absolute path (works on your machine only)
![Architecture diagram](/Users/john/project/images/architecture.png)

# Remote URL (works anywhere with internet)
![Architecture diagram](https://example.com/images/architecture.png)

# Reference-style (keeps Markdown readable)
![Architecture diagram][arch-img]

[arch-img]: ./images/architecture.png "System architecture overview"

Best practice: Use relative paths for local projects and keep all images in a dedicated images/ or assets/ folder at the same level as your Markdown file. This ensures that both Pandoc and online converters can locate the files. If you share your Markdown with collaborators, relative paths maintain portability across different machines.

Reference-Style Images

For documents with many images, reference-style syntax keeps your Markdown clean and readable. Define all image references at the bottom of the file:

The system uses a microservices architecture, as shown in
![System architecture][fig-arch]. Each service communicates
through the message broker ![Message flow][fig-mq].


[fig-arch]: ./images/architecture.png "Figure 1: System Architecture"
[fig-mq]: ./images/message-queue.png "Figure 2: Message Flow"

Both Pandoc and online converters handle reference-style images identically to inline images. The choice between the two styles is purely about readability in the source Markdown.

Common Image Problems When Converting to Word

Even when your Markdown renders perfectly on GitHub or in VS Code, the conversion to Word can introduce a range of image-specific issues. Here are the most common problems and their root causes.

Broken Images (File Not Found)

This is the single most common issue. Your Markdown references ./images/photo.png, but the converter cannot find the file. With online converters, the problem is obvious: you uploaded only the .md file, not the images folder. With Pandoc, the issue is usually a working-directory mismatch—you ran the command from a different folder than where the Markdown file lives. Always cd into the Markdown file's directory before running Pandoc, or use the --resource-path flag to specify where images are stored.

Oversized Images That Overflow the Page

A 4000x3000 pixel photograph will be inserted at its native resolution in Word, which often means it extends far beyond the page margins. Unlike browsers, Word does not automatically scale images to fit the available width. The result is a document where images are cropped at the right margin, or worse, where the page layout is completely broken. You must explicitly set dimensions in your Markdown or resize images after conversion.

Missing Images from Remote URLs

Pandoc, by default, does not download remote images referenced by URL. If your Markdown contains ![Photo](https://example.com/img.jpg), Pandoc will either skip the image or insert a placeholder. You need to either download images locally first or use the --extract-media flag. Online converters like markdown-to-word.online handle URLs automatically by fetching images at conversion time.

Base64 Encoded Images

Some Markdown editors (notably Typora and certain Jupyter notebook exports) embed images directly in the Markdown as base64-encoded data URIs: ![img](data:image/png;base64,iVBOR...). These inline images can make your Markdown file enormous (megabytes of text) and some converters choke on them. Pandoc handles base64 images reasonably well, but online converters may time out if the encoded data is too large. The best practice is to extract base64 images to separate files before converting.

SVG Images Not Rendering in Word

SVG (Scalable Vector Graphics) is widely used on the web for diagrams, icons, and charts. However, Microsoft Word has limited SVG support—older versions (before Office 2019) cannot display SVGs at all, and even newer versions may render them incorrectly. If your Markdown contains SVG images, convert them to PNG or EMF before generating the Word document. Pandoc can do this automatically with the --svg2pdf filter or the rsvg-convert tool.

Image Sizing Techniques

Standard Markdown syntax does not support image dimensions. This is a deliberate design choice—Markdown is meant to be a content format, not a layout language. However, when converting to Word, you almost always need to control image size. Here are three approaches, from simplest to most powerful.

1

HTML img Tags

Since most Markdown parsers support inline HTML, you can use the <img> tag to set explicit dimensions. This works with online converters and Pandoc alike.

# Fixed pixel dimensions
<img src="./images/screenshot.png" alt="App screenshot" width="500" height="300">

# Width only (height auto-calculated to maintain aspect ratio)
<img src="./images/diagram.png" alt="System diagram" width="600">

# Percentage of container width
<img src="./images/photo.jpg" alt="Team photo" width="80%">

# With additional styling
<img src="./images/logo.png" alt="Company logo" width="200"
     style="display:block; margin:0 auto;">

Note: Pandoc respects width and height attributes on HTML img tags when converting to docx. Percentage widths are interpreted relative to the text body width (typically about 15.9 cm on an A4 page with 2.5 cm margins). Online converters also support pixel and percentage widths.

2

Pandoc Attributes

Pandoc extends standard Markdown with attribute syntax that lets you set image dimensions directly in the Markdown image declaration. This is cleaner than inline HTML and is the recommended approach for Pandoc workflows.

# Set width to 50% of the text area
![System architecture](./images/arch.png){width=50%}

# Set exact dimensions in inches
![Dashboard screenshot](./images/dashboard.png){width=5in height=3in}

# Set width in centimeters
![Workflow diagram](./images/workflow.png){width=12cm}

# Set width in pixels (Pandoc converts to inches at 96 DPI)
![Icon set](./images/icons.png){width=400px}

# Combine with other attributes
![Data flow](./images/flow.png){width=80% #fig-flow .diagram}

Pandoc supports the following dimension units: px, cm, mm, in, and %. For Word output, percentages and inches are the most reliable. When you specify only the width, Pandoc preserves the aspect ratio automatically.

3

CSS in Online Converters

Online converters like markdown-to-word.online render Markdown to HTML first, then convert to Word. This means you can use CSS properties for fine-grained image control:

# Use max-width to prevent overflow while allowing smaller images
<img src="https://example.com/wide-chart.png" alt="Revenue chart"
     style="max-width:100%; height:auto;">

# Center an image with a max width
<img src="https://example.com/logo.png" alt="Logo"
     style="display:block; margin:0 auto; max-width:300px;">

# Add a border and padding for emphasis
<img src="https://example.com/alert.png" alt="Alert dialog"
     style="border:2px solid #e5e7eb; padding:8px; border-radius:8px; width:80%;">

CSS-based sizing is particularly useful when your images come from URLs with unknown dimensions. The max-width: 100% pattern ensures that large images shrink to fit the page while small images remain at their natural size.

Image Alignment and Text Wrapping

By default, images in Markdown are inline elements—they sit on the same line as surrounding text. When converted to Word, they typically become inline images anchored to a paragraph. For professional documents, you often want images centered, floated to the left or right, or placed with specific text-wrapping behavior.

Center Alignment

Centering is the most common alignment for figures in academic and business documents. In Markdown, use either HTML or a centered div:

# Method 1: HTML center tag (deprecated but widely supported)
<center>

![Flowchart](./images/flowchart.png)

</center>

# Method 2: Div with style (recommended)
<div style="text-align:center">

![Flowchart](./images/flowchart.png)

</div>

# Method 3: img tag with margin auto
<img src="./images/flowchart.png" alt="Flowchart"
     style="display:block; margin:0 auto; width:70%;">

Pandoc translates centered divs into centered paragraphs in Word. Online converters handle all three methods. After conversion, the image will appear centered between the left and right margins in your Word document.

Left and Right Alignment (Floating)

To float an image to the left or right with text wrapping around it, use HTML with float styling. Note that text wrapping is handled differently in Word versus browsers, so results may vary.

# Float left with text wrap
<img src="./images/headshot.jpg" alt="Author photo"
     style="float:left; margin-right:16px; margin-bottom:8px; width:150px;">

This paragraph text will wrap around the image on the right side.
Continue writing your content normally and the text will flow
naturally around the floated image.

# Float right with text wrap
<img src="./images/sidebar-chart.png" alt="Quick stats"
     style="float:right; margin-left:16px; margin-bottom:8px; width:200px;">

The summary statistics for Q4 are shown in the adjacent chart.
Revenue increased by 23% compared to the previous quarter.

Tip: Float-based layouts work well in online converters but have limited support in Pandoc's docx output. For Pandoc, it is better to place images in their own paragraph (centered) and adjust text wrapping manually in Word after conversion. In Word, right-click the image, select Wrap Text, and choose Square, Tight, or Through for text-wrapping behavior.

Adjusting Layout in Word After Conversion

Regardless of how you set alignment in Markdown, Word gives you full control over image positioning after conversion. Here are the key options:

  • In Line with Text — Image behaves like a large character in the paragraph. Moves with the text. Best for small inline icons or logos.
  • Square — Text wraps around a rectangular bounding box. Most common for professional documents with side images.
  • Tight — Text wraps closely around the image contour. Works well with transparent PNGs or irregular shapes.
  • Behind Text / In Front of Text — Image is placed on a separate layer. Useful for watermarks or background decorations.
  • Top and Bottom — Text appears above and below the image only, never beside it. Ideal for full-width figures.

Captions and Figure Numbering

Professional documents require figure captions and cross-references ("as shown in Figure 3"). Standard Markdown has no native caption syntax, but several workarounds exist depending on your conversion tool.

Pandoc Implicit Figures

When a Markdown image is the sole content of a paragraph, Pandoc treats it as a "figure" and uses the alt text as the caption. This is the simplest way to get captions in your Word output.

# This becomes a captioned figure in Word:
![Figure 1: System architecture showing the three-tier design](./images/arch.png)

# This does NOT get a caption (image is inline with text):
The architecture is shown here: ![arch](./images/arch.png) in detail.

The resulting Word document will contain the image followed by an italicized caption paragraph. To enable implicit figures, ensure that the image is the only element in its paragraph—leave blank lines above and below.

# Pandoc command for captioned figures
pandoc input.md -o output.docx

# With a custom reference document for styled captions
pandoc input.md --reference-doc=template.docx -o output.docx

Manual Caption Approach

If you need more control over caption formatting, write captions as separate text elements in your Markdown. This works with any converter:

<div style="text-align:center">

![System architecture](./images/arch.png)

*Figure 1: Three-tier system architecture with load balancing*

</div>

---

<div style="text-align:center">

![Database schema](./images/schema.png)

*Figure 2: Entity-relationship diagram for the user module*

</div>

The italicized text below each image will appear as a caption in the Word document. While this approach requires manual numbering, it gives you full control over caption text and formatting. For long documents, consider using a script to auto-number figures before conversion.

Automatic Figure Numbering with pandoc-crossref

For academic and technical documents that need automatic numbering and cross-references, the pandoc-crossref filter is indispensable:

# In your Markdown, label figures:
![System architecture](./images/arch.png){#fig:architecture}

As shown in @fig:architecture, the system uses three tiers.

# Convert with pandoc-crossref:
pandoc input.md --filter pandoc-crossref -o output.docx

# The output will read: "As shown in Figure 1, the system uses three tiers."

The pandoc-crossref filter automatically numbers all figures, tables, and equations, and resolves all cross-references. Install it separately from Pandoc (cabal install pandoc-crossref or download prebuilt binaries from GitHub). It is the closest you can get to LaTeX-style figure management in a Markdown-to-Word workflow.

Converting with Different Tools

The tool you choose for conversion determines how images are handled, what formats are supported, and how much manual cleanup is needed afterward. Here is a detailed comparison of the two main approaches.

1

Online Converter

Our Markdown to Word online converter handles images by fetching remote URLs at conversion time and embedding them directly into the Word document. This makes it ideal for documents that reference images hosted on the web (GitHub repositories, CDNs, image hosting services).

Step-by-step:

  1. Open markdown-to-word.online in your browser.
  2. Paste or type your Markdown with image references. For remote images, use full URLs.
  3. Preview the document in the right panel to verify images load correctly.
  4. Click "Download DOCX" to generate the Word file with embedded images.
  5. Open in Word and fine-tune image sizes and positions as needed.

Pros: No installation required, handles remote URLs automatically, supports HTML img tags with width/height, live preview before download, free to use.

Limitations: Cannot access local file-system images (use URLs instead), large base64-encoded images may cause timeouts.

2

Pandoc (Command Line)

Pandoc excels at converting Markdown with local images. It reads image files from your file system and embeds them directly into the .docx output. It also supports Pandoc-specific attributes for sizing and captioning.

# Basic conversion (images must be in relative paths)
pandoc report.md -o report.docx

# Specify resource path for images in a different directory
pandoc report.md --resource-path=./assets:./images -o report.docx

# Extract and embed media from remote URLs
pandoc report.md --extract-media=./media -o report.docx

# Use a custom Word template for consistent styling
pandoc report.md --reference-doc=company-template.docx -o report.docx

# Full pipeline with crossref, custom template, and DPI setting
pandoc report.md \
  --filter pandoc-crossref \
  --reference-doc=template.docx \
  --dpi=300 \
  -o report.docx

Pros: Full control over output, handles local files natively, supports Pandoc attributes for sizing, automatic captions via implicit figures, custom templates, pandoc-crossref for numbering.

Limitations: Requires installation, command-line knowledge needed, does not fetch remote URLs by default (use --extract-media).

Feature Comparison

Feature Online Converter Pandoc
Local images Not supported (use URLs) Fully supported
Remote URL images Auto-fetched and embedded Requires --extract-media
Image sizing (HTML) width, height, CSS width, height attributes
Image sizing (Pandoc attrs) Not supported {width=50%}, {width=5in}
Automatic captions Manual (italic text) Implicit figures + crossref
SVG support Converted to raster Via svg2pdf filter
Base64 images Limited (size cap) Supported
Setup required None (browser only) Install Pandoc + filters
Custom Word template Not supported --reference-doc
Batch processing One file at a time Scriptable via shell loops

Image Formats: PNG vs JPEG vs SVG

The image format you choose affects file size, quality, and compatibility in the final Word document. Different types of images call for different formats, and understanding the trade-offs will help you produce professional documents that look sharp on screen and in print.

Format Best For Compression Transparency Word Support
PNG Screenshots, diagrams, UI mockups, text-heavy images Lossless Yes (alpha channel) Excellent
JPEG Photographs, real-world images, gradients Lossy (adjustable) No Excellent
SVG Vector diagrams, icons, charts, logos N/A (vector) Yes Limited (Office 2019+)
GIF Simple animations (first frame only in Word) Lossless (256 colors) Binary only Good (static only)
WebP Web-optimized images Both lossy/lossless Yes Poor (Office 365 only)
EMF Windows vector graphics N/A (vector) Limited Excellent (Windows only)

DPI Considerations for Print

DPI (dots per inch) determines how sharp an image looks when printed. While screen resolution is typically 72–96 DPI, professional printing requires 300 DPI. Here is how to calculate the minimum pixel dimensions for your images:

Formula: Pixels = Print Size (inches) x DPI

A 5-inch-wide image at 300 DPI needs: 5 x 300 = 1500 pixels wide

A full A4 page width (6.27 inches after margins) at 300 DPI needs: 6.27 x 300 = 1881 pixels wide

Pandoc uses 96 DPI by default when converting pixel dimensions to physical sizes. You can override this with the --dpi flag:

# Default: 96 DPI (a 960px image becomes 10 inches wide)
pandoc input.md -o output.docx

# Print-quality: 300 DPI (a 960px image becomes 3.2 inches wide)
pandoc input.md --dpi=300 -o output.docx

Recommendation: For documents that will be printed, use --dpi=300 and ensure all images are at least 1500 pixels wide. For screen-only documents (email attachments, on-screen reading), the default 96 DPI is fine. Using PNG for screenshots/diagrams and JPEG (quality 85+) for photographs gives the best balance of file size and visual quality.

Batch Processing Images

When working with large documents containing dozens of images, manual handling is impractical. These scripts automate the most common image preparation tasks before conversion to Word.

Download All Remote Images

If your Markdown references images by URL, this script downloads them locally so Pandoc can embed them. It also updates the Markdown file to use local paths.

#!/bin/bash
# download-images.sh - Download remote images and update Markdown paths
# Usage: ./download-images.sh input.md

INPUT="$1"
IMG_DIR="./images"
mkdir -p "$IMG_DIR"

# Extract image URLs from Markdown
grep -oP '!\[.*?\]\(\K(https?://[^\s)]+)' "$INPUT" | while read -r url; do
    filename=$(basename "$url" | sed 's/[?#].*//')
    echo "Downloading: $url -> $IMG_DIR/$filename"
    curl -sL "$url" -o "$IMG_DIR/$filename"
done

# Replace URLs with local paths in the Markdown
sed -i.bak -E 's|!\[([^\]]*)\]\(https?://[^)]*?/([^/?#)]+)[^)]*\)|![\1](./images/\2)|g' "$INPUT"
echo "Done. Original file backed up as ${INPUT}.bak"

Resize Images for Word

This script uses ImageMagick to resize all images in a directory to a maximum width suitable for A4 Word documents, preserving aspect ratios and converting unsupported formats.

#!/bin/bash
# resize-for-word.sh - Prepare images for Word documents
# Requires: ImageMagick (convert command)
# Usage: ./resize-for-word.sh ./images

IMG_DIR="${1:-.images}"
MAX_WIDTH=1800   # ~6 inches at 300 DPI
QUALITY=90

for img in "$IMG_DIR"/*.{png,jpg,jpeg,gif,webp,svg}; do
    [ -f "$img" ] || continue
    ext="${img##*.}"
    base="${img%.*}"

    # Convert SVG to PNG
    if [ "$ext" = "svg" ]; then
        echo "Converting SVG: $img -> ${base}.png"
        convert "$img" -density 300 "${base}.png"
        img="${base}.png"
    fi

    # Convert WebP to PNG
    if [ "$ext" = "webp" ]; then
        echo "Converting WebP: $img -> ${base}.png"
        convert "$img" "${base}.png"
        img="${base}.png"
    fi

    # Resize if wider than MAX_WIDTH
    width=$(identify -format "%w" "$img" 2>/dev/null)
    if [ "$width" -gt "$MAX_WIDTH" ] 2>/dev/null; then
        echo "Resizing: $img ($width px -> $MAX_WIDTH px)"
        convert "$img" -resize "${MAX_WIDTH}x>" -quality "$QUALITY" "$img"
    fi
done

echo "All images processed for Word compatibility."

Batch Convert Multiple Markdown Files

When you have an entire folder of Markdown files with images to convert, combine the preparation scripts with Pandoc in a single pipeline:

#!/bin/bash
# batch-convert.sh - Convert all .md files to .docx with images
# Usage: ./batch-convert.sh ./docs ./output

SRC_DIR="${1:-.}"
OUT_DIR="${2:-./output}"
mkdir -p "$OUT_DIR"

for md in "$SRC_DIR"/*.md; do
    [ -f "$md" ] || continue
    basename=$(basename "$md" .md)
    echo "Converting: $md -> $OUT_DIR/${basename}.docx"

    pandoc "$md" \
        --resource-path="$(dirname "$md")" \
        --dpi=300 \
        --reference-doc=template.docx \
        -o "$OUT_DIR/${basename}.docx"
done

echo "Batch conversion complete. Output in $OUT_DIR"

Tip: For very large batches (100+ files), use GNU Parallel to speed up conversion: find . -name "*.md" | parallel pandoc {} --dpi=300 -o {.}.docx. Each conversion runs in a separate process, fully utilizing multi-core CPUs.

Frequently Asked Questions

Can I convert Markdown with images to Word without installing any software?

Yes. Our online Markdown to Word converter runs entirely in your browser and requires no installation. Simply paste your Markdown, ensure your images use full URLs (not local file paths), and download the Word document. The converter fetches remote images automatically and embeds them in the .docx file. For local images, you can first upload them to an image hosting service or convert them to base64 data URIs.

Why are my images blurry in the Word document?

Blurry images are almost always caused by insufficient resolution. If a 300-pixel-wide image is displayed at 6 inches wide in Word, it is only 50 DPI—far below the 150 DPI minimum for readable screen display and the 300 DPI standard for print. The fix is to use higher-resolution source images. As a rule of thumb, multiply the desired print width in inches by 300 to get the minimum pixel width. Also check that Word is not compressing images: go to File > Options > Advanced > Image Size and Quality and select "Do not compress images in file."

How do I handle images in GitHub Flavored Markdown for Word conversion?

GitHub Flavored Markdown (GFM) uses the same image syntax as standard Markdown. However, GitHub repositories often use relative paths like ./docs/images/fig1.png that reference files in the repo. When converting these files to Word, you have two options: (1) Clone the repository and run Pandoc locally with pandoc README.md -f gfm -o output.docx from the repo root, so relative paths resolve correctly. (2) Replace relative paths with raw GitHub URLs: https://raw.githubusercontent.com/user/repo/main/docs/images/fig1.png and use the online converter. Our GitHub README to Word guide covers this workflow in detail.

What is the maximum image file size for Word documents?

Word itself does not impose a strict per-image file size limit, but practical constraints apply. A .docx file is a ZIP archive, and the overall document size affects performance. Documents larger than 50 MB become slow to open and may cause issues in email attachments. As a guideline, keep individual images under 2 MB (use JPEG quality 80–90 for photographs and PNG for diagrams). For a document with 20+ images, optimize all images before conversion. Use convert image.png -quality 85 image.jpg (ImageMagick) or online tools like TinyPNG to compress without visible quality loss.

Can I use Markdown image syntax with animated GIFs?

You can include GIFs in your Markdown using the standard image syntax, but Word does not support animated images. When you convert to Word, only the first frame of the GIF will be displayed as a static image. If animation is important, consider two alternatives: (1) Include the static GIF for the Word version and add a note like "(see animated version at [URL])" with a link to the hosted GIF. (2) Extract key frames from the animation and include them as a sequence of images in your document. For screen recordings or UI demonstrations, a series of annotated screenshots is usually more effective in a Word document than an animation would be.

Ready to Convert Your Markdown Images to Word?

Our free online converter automatically fetches remote images, embeds them in your Word document, and preserves sizing. No signup required—just paste your Markdown and download.

Try the Converter Now

Free, no account needed. Supports PNG, JPEG, GIF, and remote URLs.

Related Articles