How to convert Mermaid to SVG
- Paste your Mermaid code above.
- Choose a theme and background. The preview updates in the browser.
- Download SVG and Copy SVG code are on Pro ($11.99/month or $119.90/year). Every plan can still download a PNG and copy the Mermaid source.
Why SVG is the best format for diagrams
SVG is a vector format: it stays perfectly sharp at any size, the file is usually tiny, and text inside it remains selectable and searchable. It's ideal for documentation sites, blog posts and design hand-offs.
Compatibility
MermaidViewer exports SVG using real SVG <text> labels instead of HTML foreignObject elements, so the file opens correctly in Figma, Adobe Illustrator, Inkscape, PowerPoint and Keynote — not just in browsers.
- Need a raster image? Use Mermaid to PNG.
- Need a document? Use Mermaid to PDF.
- Want to style it first? Read the themes and styling guide.
Convert mermaid to svg when the picture has to stay sharp at any size. Paste the code on this page, choose a theme and a background, and preview the drawing. The preview runs in your browser and the diagram is not uploaded. Downloading the file, and copying the SVG markup, are included with Pro ($11.99/month or $119.90/year). Every plan can still download a PNG and copy the Mermaid source.
SVG is a drawing, not a grid of pixels. Zoom does not soften the text. A docs site can place the file in a page and it still looks like type, because it is type. That is why SVG is the default we would pick for a handbook, a design handoff, or anywhere the image might be reused at another size. PNG is the fallback when the destination refuses vectors.
Why this format earns the extra step
A PNG has a resolution decision baked in. Export at 1x and a slide looks soft. Export at 3x and a tiny icon is a heavy file. SVG skips that choice. The same file is fine in a sidebar and on a projector, as long as the app honors SVG. Browsers do. Modern docs tools do. Some chat apps do not, and those apps are why the PNG converter exists.
File size is usually in SVG's favor for a diagram. Boxes and text compress as instructions. A photo would not. A diagram is not a photo. You also get text that a browser can search and a screen reader can meet as text, which a flattened PNG cannot offer. Do not treat that as a full accessibility program. Alt text in the page still matters. It does mean the words in the boxes are not trapped in pixels.
Design tools are the other reason people ask for SVG. The export from this stack uses SVG text for labels rather than HTML foreignObject elements. That is what lets the file open in Figma, Illustrator, Inkscape, and similar tools, instead of showing blank labels the way a browser-only SVG sometimes does. You can recolor a box there. You should still keep the Mermaid. The SVG is a snapshot of a layout. The source is what you edit next week.
The same Pro gate as the editor
SVG download is Pro in /editor and on this page. Free PNG is 1× with a small watermark. Starter ($6.99 a month or $69.90 a year) unlocks PNG up to 4× with no watermark. Pro ($11.99 a month or $119.90 a year) adds SVG, JPG up to 8×, and PDF. The preview here is free. Download SVG and Copy SVG code are on Pro. Copying the Mermaid source does not require Pro. Pricing lists the plans.
What to do with the markup
Download gives you a .svg file. Copy gives you the markup to paste into HTML. A simple page can drop that markup inline, which lets the text inherit nothing it should not and keeps the request count at zero. For a larger site, a file in the repo is easier to cache and review. Either way, look at the picture in the destination, not only in the preview. A dark theme that looked fine here can disappear on a dark docs theme if the text color and the page color match. Switch to a light theme or set a solid background before you blame the embed.
flowchart LR
A[Mermaid source] --> B[SVG download]
B --> C[Docs page or Figma]
C --> D[Edit the source next time]The preview above is the habit. Source first, file second. When a label changes, change the source and export again. Editing only the SVG is how the repo grows a drawing nobody can regenerate.
Limits worth knowing before you promise the file
SVG from Mermaid is a diagram, not a universal illustration format. Very new Mermaid features render only on hosts with a new enough library. This page uses the library this site ships. If you need to know whether GitHub will render the same syntax, paste it into a README or into mermaid.live as well. The file you download here is already rendered. GitHub will render the source again with its own build. Those can differ. The export guide talks through that split.
Huge diagrams produce huge SVG documents. The file is still "vector," and it can still be slow to open. Split the picture. Fonts depend on the viewer. The export names a font, and the laptop that opens the file may substitute another. If the picture must look identical on a machine you do not control, a PNG or a PDF is the more frozen choice. Use SVG when sharpness and editability matter more than a pixel-identical snapshot.
Interactive Mermaid, such as click handlers, does not survive as a useful control in a static SVG you hand to someone. Export the picture. Put the link in the surrounding paragraph. That is the same constraint GitHub already applies for security, and it is a good constraint in a file too.
Where the file should live
Commit the Mermaid. Commit the SVG only when a consumer cannot run Mermaid. A pull request that changes both will show a text diff and a binary or XML diff. Review the text. Regenerate the SVG from this page or from the editor so they do not drift. For a one-off Slack post, skip the commit and use PNG. For a design file, SVG is the handoff, and the designer should know the source exists so they do not become the only person who can change a label.
The Markdown viewer helps when the diagram is one fence inside a longer file and you want to see it in context before you export. None of that viewing or converting uploads the diagram for the convert action. The browser does the work. You keep the file.
Frequently asked questions
Will the SVG work in Figma or Illustrator?
Yes. Labels are exported as SVG text rather than embedded HTML, which design tools can import.
Can I get the SVG code instead of a file?
Yes, on Pro ($11.99/month or $119.90/year). Click Copy SVG code to copy the markup. The preview itself stays free, and PNG download stays on every plan.
Is the SVG download free?
The live preview is free and needs no account. Downloading the SVG, and copying the SVG markup, are part of Pro ($11.99/month or $119.90/year). PNG download stays on every plan, at 1× with a watermark on Free.
More converters
- Mermaid to PNG — Convert Mermaid to PNG in your browser.
- Mermaid to PDF — Convert Mermaid to a vector PDF in your browser.
- Markdown Mermaid Viewer — Paste Markdown (README, docs, notes) and preview every ```mermaid code block as a rendered diagram.
- AI diagram generator — create Mermaid diagrams from text.