Convert Mermaid Diagrams to PDF

Convert a Mermaid diagram to PDF by pasting its source and saving it as sharp vector artwork, all in your browser. The diagram is drawn on your device and never uploaded.

The diagram is rendered on your device only.

How it works

  1. Paste your Mermaid diagram source, starting with its type keyword.
  2. Choose page size and a light or dark theme.
  3. Click Print or Save as PDF once the diagram appears in the preview.

Which diagrams render, and how they stay sharp

The same Mermaid source you write in a fenced code block is drawn here: flowcharts, sequence, class, state, and entity-relationship diagrams, Gantt and pie charts, and more. Mermaid produces an SVG, so the diagram is vector artwork that stays crisp at any zoom and prints without the blur you get from a screenshot.

For a diagram that lives inside a longer document, the Markdown to PDF converter renders mermaid blocks in place alongside prose and tables.

Why Mermaid needs JavaScript, and how the PDF is made

Unlike a static image, a Mermaid diagram is generated from text at runtime, so the library has to execute in the browser to lay out the nodes and edges. It is loaded only when you convert a diagram, then the resulting SVG is placed on the page and handed to the print pipeline. If scripts are disabled the diagram cannot be drawn, and if the syntax is invalid the raw source is shown so the error is visible.

For rendering the surrounding source text instead, the code to PDF converter keeps highlighting. See how browser-side rendering works.

Frequently asked questions

Is there anything this cannot render?
Rendering needs JavaScript, since Mermaid draws the diagram in the browser; with scripts blocked, nothing draws. If the diagram syntax has an error, the source is shown as a code block instead of a broken image, so you can see and fix it. Very large diagrams may extend past one page.
Which diagram types are supported?
Whatever the bundled Mermaid version renders: flowcharts, sequence diagrams, class and state diagrams, entity-relationship diagrams, Gantt charts, pie charts, and Git graphs among others. Paste the same source you would use in a fenced mermaid block, starting with the diagram keyword such as flowchart, sequenceDiagram, or classDiagram.
Can I keep a diagram inside a larger document?
Yes. If the diagram belongs in a report with headings, prose, and tables, write it as a fenced mermaid code block and use the Markdown to PDF converter, which renders the diagram in place. This page is for turning a single standalone diagram into a PDF.
Is my diagram uploaded anywhere?
No. The Mermaid library runs in your browser and draws the diagram on your device. The source never leaves the machine, there is no account, and once the library has loaded the tool works offline.

Related tools

Related guides