Mermaid · Export
Export a Mermaid diagram to PNG or SVG, nothing to install
Paste the Mermaid code into an editor that renders in the browser and download the result: SVG when the diagram goes into a document or a web page and must stay sharp, PNG when it goes somewhere that only takes images. For repeated exports from files, the Mermaid command-line tool does the same thing, but needs Node.js.
Updated
The short answer
Open our free online Mermaid editor, paste the code, and press Download SVG or Download PNG. The diagram is drawn by Mermaid inside your browser, so the text never leaves your machine, and nothing has to be installed. The steps below explain which format to pick and the settings that matter.
SVG or PNG
SVG is the diagram as vector shapes and text. It stays sharp at any size, is small, and its text can still be searched and selected. Use it for web pages, documentation tools that accept SVG, and anything that will be zoomed or printed.
PNG is a picture made of pixels. Use it where only images are accepted: chat messages, slides in some tools, issue trackers, emails. Our editor exports PNG at twice the diagram's size so it stays readable on high-density screens.
If you are unsure, keep the SVG as the master copy and make a PNG from it when a place refuses SVG.
Step by step in the browser
1. Open the editor and paste your code into the left pane, or pick one of the ten examples. The preview updates as you type; if a line is wrong, the error names the line and the last good diagram stays visible, faded.
2. Choose the theme: Light or Dark, depending on where the image will sit.
3. Choose the background: Solid paints the theme's background behind the diagram, Transparent leaves it empty. Transparent suits slides and pages with their own background; solid is safer for chat apps and documents that might switch between light and dark.
4. Press Download SVG, Copy SVG (to paste the markup somewhere) or Download PNG.
To send the diagram to a colleague instead of a file, Copy share link puts the code into the part of the address after #, which browsers do not send to the server.
Why some PNG exports come out blank
Mermaid can draw labels as HTML inside the SVG (an element called foreignObject). A browser will not let a page turn such an SVG into PNG pixels, so tools that export this way can produce an empty or failed image. Our editor renders flowchart labels as plain SVG text and, for the diagram types that still use HTML labels, replaces them with SVG text at PNG export time. If you export with another tool and the PNG is blank, this is the first thing to check.
When the command line is the better tool
For many diagrams kept as files in a repository, the Mermaid CLI (mmdc, from the mermaid-cli project) converts .mmd files to SVG, PNG or PDF in a script or a build step. It needs Node.js and downloads a headless browser to do the drawing, so it is an install, but it makes exports repeatable. For one diagram now, the browser is quicker.
If the diagram lives in Confluence
An exported image is a copy: the next change means exporting and uploading again. If the diagram belongs on a Confluence page, Mermaid Studio for Confluence keeps the Mermaid code on the page and renders it there, so a change is an edit, not a new file. It is free for up to 10 users.
Limits
The editor's behaviour described here was checked on 28 November 2026 with Mermaid 12.3.0. Very large diagrams make large PNGs at 2×; if a PNG is too big for where it is going, export SVG instead. The share link has a length limit, and the editor says so when a diagram is too long for it.
Sources
Questions and answers
How do I convert Mermaid to PNG online?
Paste the code into a browser-based Mermaid editor and download the PNG. Ours renders locally, so the code is not uploaded.
Should I export Mermaid as SVG or PNG?
SVG when the place accepts it: it stays sharp and its text stays searchable. PNG where only images are accepted.
Why is my exported Mermaid PNG blank?
Usually because the labels are HTML inside the SVG, which browsers will not turn into PNG pixels. Export with plain SVG labels, or export SVG instead.
Can I export Mermaid diagrams in bulk?
Yes, with the Mermaid CLI (mmdc) in a script. It needs Node.js.
How to cite this
Going Stellar (2026). Export a Mermaid diagram to PNG or SVG, nothing to install. GOING STELLAR S.R.L..
https://goingstellar.ro/methods/export-mermaid-diagram-png-svg/