MermaidJS Playground

Edit Mermaid diagrams with live SVG preview and export.

The Mermaid Playground turns Mermaid text into a diagram. Type or paste the source on the left, watch the preview update shortly after you stop typing, and download the result as SVG or PNG.

What is Mermaid?

Mermaid is a text-based diagramming language. You describe a diagram in a short syntax and a JavaScript library draws it as SVG. It covers flowcharts, sequence diagrams, class diagrams, state diagrams, entity relationship diagrams, Gantt charts, pie charts and more. The first word or line of the source declares the diagram type, for example flowchart TD for a top-down flowchart, sequenceDiagram or erDiagram. Because the diagram is plain text, it can live in version control, be reviewed in a pull request and be changed with an ordinary edit instead of a drawing program. Many documentation systems and Git hosts render Mermaid blocks, but the supported syntax depends on the Mermaid version they bundle, so a diagram that works here can behave differently elsewhere. This playground uses Mermaid in strict security mode with HTML labels turned off, which affects what label markup is allowed.

How to use MermaidJS Playground

  1. Pick a sample or start empty Choose Flowchart, Sequence, ER or Class under Sample diagram to load starter text, or clear the Mermaid source box and write your own.
  2. Edit the Mermaid source Change the text in the Mermaid source box. The Preview refreshes after a short pause.
  3. Fix errors If a Diagram error box appears, read the message, correct the source and wait for the preview to re-render.
  4. Export the image Click Download SVG or Download PNG. The files are named diagram.svg and diagram.png. Both buttons stay disabled until a diagram has rendered.
  5. Copy the source Use Copy source to put the Mermaid text on your clipboard for a README or documentation page.

Frequently asked questions

Is my diagram text uploaded?

No. Mermaid is loaded on demand and runs in the page. The source is not sent to a server by this tool.

What do the Sample diagram options do?

They replace the source with a starter example: Flowchart, Sequence, ER or Class. They overwrite whatever is in the box, so copy your own text first.

Can I export a PNG?

Yes, with Download PNG. It is rendered at 2x scale on a white background with each side capped at 8000 pixels. Download SVG gives a vector file.

Why does my diagram look different on GitHub or in another tool?

Mermaid syntax and rendering change between versions, and other sites may use different security and label settings. This playground uses strict security with HTML labels off.

Which Mermaid version is used?

The project depends on Mermaid 12.x (^12.3.0). The exact installed patch version is not shown in the tool.

Is the SVG output safe to embed?

The generated SVG is passed through DOMPurify with its SVG profile before it is shown or downloaded, which removes scripts and event handlers.