Skip to content
All Markdown syntax

Resize an image in Markdown

Links and images

Markdown syntax

Needs HTML
<img src="chart.png" width="400" alt="Chart">

HTML. Works on GitHub. Set width only to keep the aspect ratio.

The ![]() syntax has no size option. The portable way is an <img> tag with a width; give only the width so the height scales with it.

All ways to write it

  • <img src="chart.png" width="400" alt="Chart">
    HTML. Works on GitHub. Set width only to keep the aspect ratio.Needs HTML
  • ![Chart](chart.png){width=50%}
    Pandoc and Quarto attributes.Some tools only
  • ![[chart.png|400]]
    Obsidian embed with a width in pixels.Some tools only

Example

You type

<img src="https://yamuno.com/logo.png" width="120" alt="Yamuno logo">

You get

Yamuno logo

The logo shows 120 pixels wide, with the height scaled to match.

Questions

Can I use a percentage width?

Yes, width="50%" works in the <img> tag on GitHub and in most HTML-capable renderers.

Does style="width:..." work on GitHub?

No, GitHub strips style attributes. Use the width attribute instead.

Image size in Confluence

After an import with Markdown Importer, images are normal Confluence attachments, so you resize them on the page with the editor's image handles.

Related syntax

Also in Links and images

See all Markdown syntax