Free and open source. No sign-up.
Free Online Mermaid Visual Editor
Draw a diagram and get the Mermaid code. Or paste some Mermaid and fix it by dragging things around. It works with flowcharts and sequence diagrams, including the ones you copy out of GitHub, a wiki or ChatGPT.
- Code and canvas stay in syncType in the code panel and the diagram updates. Drag something on the canvas and the code changes to match.
- Saves regular MermaidYou save ordinary Mermaid, so it still renders on GitHub, GitLab, Notion and Obsidian. Flowcharts get one extra comment that remembers the layout, and other tools ignore it.
- Doesn’t need Mermaid.jsThe plugin reads your diagrams itself and draws them as plain SVG. There’s no script to load and nothing comes from a CDN.
Install
npm install @react-markdown-kit/mermaidThat’s everything you need to render diagrams and use the canvas. npm installs the renderer for you. If you also want to edit diagrams inside a Markdown editor, step 3 below shows how.
Since it never loads Mermaid.js, it works in server components and static builds too.
Using the canvas on its own
The editor you’re using on this page is the standalone canvas. You give it Mermaid and it gives you Mermaid back (you don’t need a Markdown editor for this). It fills whatever container you put it in.
In a React app:
import { MermaidCanvas } from '@react-markdown-kit/mermaid/canvas'
import '@react-markdown-kit/mermaid/styles.css'
<div style={{ height: 600 }}>
<MermaidCanvas value={source} onChange={setSource} />
</div>Or mount it into any element on the page:
import { createMermaidCanvas } from '@react-markdown-kit/mermaid/canvas'
const canvas = createMermaidCanvas(document.getElementById('diagram'), {
value: 'flowchart LR\n a[Web] --> b[API]',
onChange: (source) => save(source),
})A few things to try on the canvas:
- Double-click a shape or an arrow to type in it. Press Enter for a new line.
- Select a shape to change its colour, stroke width, dashes and corners, or an arrow to change its arrowheads. Cmd+D (Ctrl+D on Windows) makes a copy.
- Shift+click, or drag a box around a few shapes, to select them together. Drag to move them, or pull a handle on the frame to resize them. Hold Alt to resize from the centre.
- Nudge the selection with the arrow keys, and hold Shift for bigger steps.
- Cmd+Z or Ctrl+Z undoes the last change.
Adding Mermaid to your app
- Render your diagrams. Add
mermaid()to your preset and every```mermaidblock in your Markdown turns into an SVG.import Markdown, { defineMarkdownPreset } from '@react-markdown-kit/renderer' import { mermaid } from '@react-markdown-kit/mermaid' import '@react-markdown-kit/mermaid/styles.css' const preset = defineMarkdownPreset({ extensions: [mermaid()] }) <Markdown preset={preset}>{content}</Markdown> - Write regular Mermaid. Use the same syntax you’d put in a GitHub README. If a flowchart has no layout saved yet, it gets laid out for you.
```mermaid flowchart LR web[Web App] -->|REST| api[API] api --> db[(Postgres)] style web fill:#a5d8ff,stroke:#1971c2 ``` - Edit them on a canvas. Install the editor, then use the
mermaid()from the/editorentry in your editor’s preset. When you drag a flowchart around, the plugin saves the positions in a%% rmk-layout v1comment at the end of the diagram. Other Mermaid tools ignore that comment, so nothing breaks. Sequence diagrams don’t need it at all.npm install @react-markdown-kit/editorimport { defineMarkdownPreset } from '@react-markdown-kit/renderer' import { MarkdownEditor } from '@react-markdown-kit/editor' import { mermaid } from '@react-markdown-kit/mermaid/editor' const preset = defineMarkdownPreset({ extensions: [mermaid()] }) <MarkdownEditor preset={preset} value={source} onChange={setSource} />
More docs. The Mermaid plugin docs cover every supported shape and arrow, the layout comment and all the editor options, and Editor basics explains the editor itself. There are also guides for using Mermaid in React without Mermaid.js, switching from the Mermaid Live Editor, turning a flowchart into Mermaid and fixing Mermaid that an AI wrote.
About this editor
- The panel on the right is your Mermaid code, and the rest of the window is the canvas. If Mermaid would reject something in your code, the chip next to the title at the top left tells you which line.
- Class, state, Gantt and the other diagram types show up as code, and they’re saved exactly as you wrote them. Your own app can still draw them with Mermaid.js through the plugin’s fallback entry. Delete the layout comment from a flowchart and it goes back to automatic layout.
- The editor demo shows diagrams next to regular Markdown, tables and template variables. If you only need rendering, there’s also the renderer demo.
Adding an “Open in visual editor” badge
Every link to this editor carries the whole diagram inside the URL (#pako:, compressed the same way mermaid.live does it). Nothing gets uploaded and there’s no server involved. Put this in a README and people can open your diagram with one click. To get the snippet for your own diagram, press Share in the editor above.
[](https://reactmarkdownkit.com/mermaid-editor#pako:eJyNzMFrwjAUBvD7_orHK4KDFNqgm-Yw6EFw4EF0sEPpIWlSG5qZ0GTWov3fpc6dt9N78P2-rzK2K2veBtjsngAAOiXyTyUgc66AOH677lb7jytwp_Ns-17cDXd6jECKfLq1Phxa5Z9_Ih96o8YRqLQxLOJzuagq4kNrG8WidPmalvQuJxNov5rY8N5-BzilcMGSH0_cr5U-1AEZpQnBo5XKI7tgp8R4zshmCcEe2UtCsNMy1MjS8a8ftWUyEOROPzRd_IPL3-05_VMPww18tFoi)The badge image lives at /badge.svg. The link in the example above opens this flowchart:
flowchart LR
web[Web App] -->|REST| api[API]
api --> db[(Postgres)]
style web fill:#a5d8ff,stroke:#1971c2
%% rmk-layout v1 {"canvasHeight":220,"nodes":{"web":{"x":40,"y":60,"width":160,"height":90},"api":{"x":280,"y":60,"width":160,"height":90},"db":{"x":520,"y":60,"width":160,"height":90}}}To put the editor inside a blog post or a docs page, add ?embed=1 to any link. That hides the rest of the site:
<iframe src="https://reactmarkdownkit.com/mermaid-editor?embed=1#pako:eJyNzMFrwjAUBvD7_orHK4KDFNqgm-Yw6EFw4EF0sEPpIWlSG5qZ0GTWov3fpc6dt9N78P2-rzK2K2veBtjsngAAOiXyTyUgc66AOH677lb7jytwp_Ns-17cDXd6jECKfLq1Phxa5Z9_Ih96o8YRqLQxLOJzuagq4kNrG8WidPmalvQuJxNov5rY8N5-BzilcMGSH0_cr5U-1AEZpQnBo5XKI7tgp8R4zshmCcEe2UtCsNMy1MjS8a8ftWUyEOROPzRd_IPL3-05_VMPww18tFoi" width="100%" height="520" style="border:0" title="Mermaid visual editor" loading="lazy"></iframe>Questions
- Is there a free Mermaid visual editor?
- Yes, you're on it. It runs in your browser, it's free, and you don't need an account. It's built on @react-markdown-kit/mermaid, which is MIT licensed. The package on npm.
- Can I drag and drop nodes in Mermaid?
- Yes. Drag a box or an arrow in a flowchart and the code updates as you go. The positions are saved in one comment at the end of the diagram (%% rmk-layout v1), and other Mermaid tools skip it. In a sequence diagram you can drag participants to reorder them and drag messages to move them, and that doesn't add a comment at all. How the layout comment works.
- How do I turn a flowchart into Mermaid syntax?
- Draw it here. Add boxes and arrows on the canvas, then copy the Mermaid from the code panel. It can't read a picture of a flowchart, though. You have to draw it on the canvas.
- Does the Mermaid it writes render on GitHub?
- Yes. What you get is regular Mermaid, so it renders on GitHub, GitLab, Notion and Obsidian. The React Markdown Kit renderer shows it as an SVG too.
- Which Mermaid diagram types does it support?
- Flowcharts (flowchart or graph) and sequence diagrams, and both open on a canvas. In a flowchart you drag boxes and arrows around. In a sequence diagram you add participants, draw messages between them, add notes and wrap steps in loop, alt or par blocks. Class, state, Gantt and the other types show up as code and are saved exactly as you wrote them. Your app can still draw those with Mermaid.js if you want.
- Can I share a diagram by link?
- Yes. Copy link packs the whole diagram into the URL, layout included. Nothing is uploaded and no server is involved. Whoever opens the link gets the same drawing on the canvas.
- Does it need Mermaid.js or a server?
- No. The plugin reads flowcharts and sequence diagrams on its own and draws them as SVG, so Mermaid.js never loads. Once the page is open, everything happens in your browser and nothing you type is sent anywhere.