Mr. Tools

How to

How to use Mermaid Preview

A preview tool for Mermaid diagrams. It is useful when you want to quickly try syntax while shaping a diagram or check the appearance of specification diagrams. Switching themes lets you compare how the output looks before sharing it.

Mermaid Preview thumbnailMermaid Preview thumbnail

Use Cases

When to use it

  • Quickly check a flowchart for a specification
  • Try out sequence diagram syntax while refining it
  • Check how a Mermaid diagram looks before pasting it into a document
  • Tidy up a sequence diagram quickly before a design review
  • Try out ER diagram or Gantt chart syntax
  • Check how a diagram looks before sharing it with your team

Capabilities

What this tool can do

  • View Mermaid code and the diagram side by side
  • Switch themes
  • Check syntax errors and copy the source
  • Save as SVG or PNG, or copy to the clipboard
  • Show error messages below the preview as you type
  • Draw flowcharts, sequence diagrams, ER diagrams and other main diagram types

Guide

How to use each screen area

Learn how to use each screen area, including settings, input, previews, results, and saving.

01 HOWTO

Syntax editor area

Write Mermaid syntax in the left editor. Start from a diagram template, add context-aware insert suggestions, and check the structure in the preview as you edit.

Screen showing Syntax editor area in Mermaid PreviewScreen showing Syntax editor area in Mermaid Preview

What this area does

  • Enter Mermaid syntax directly
  • Insert a starter template for the diagram type
  • Add suggestions that match the current diagram type
  • Fix input while checking preview errors

Where to use it

01
Syntax input

Enter Mermaid syntax for flowcharts, sequence diagrams, class diagrams, and other diagrams.

Screen showing where to use Syntax input in Mermaid PreviewScreen showing where to use Syntax input in Mermaid Preview
02
Template selection

When the editor is empty, choose a diagram type and insert its starter structure.

Screen showing where to use Template selection in Mermaid PreviewScreen showing where to use Template selection in Mermaid Preview
03
Input suggestions

Add matching items such as nodes, edges, branches, or loops at the cursor position.

Screen showing where to use Input suggestions in Mermaid PreviewScreen showing where to use Input suggestions in Mermaid Preview
04
Error review

When the syntax has a problem, use the preview-side message to correct the input.

Screen showing where to use Error review in Mermaid PreviewScreen showing where to use Error review in Mermaid Preview

02 HOWTO

Input suggestions and editor tools

Use the templates and suggestions above the editor, the history control in the top bar, and clear or copy actions in the editor header. This area helps you create a base diagram, add parts, and reuse a draft.

Screen showing Input suggestions and editor tools in Mermaid PreviewScreen showing Input suggestions and editor tools in Mermaid Preview

What this area does

  • Insert a template for the diagram type
  • Add parts that match the current diagram
  • Return to a recent editing state from history
  • Clear or copy the current syntax

Where to use it

01
Templates

Choose a starter structure for a flowchart, sequence diagram, class diagram, or another diagram type.

Screen showing where to use Templates in Mermaid PreviewScreen showing where to use Templates in Mermaid Preview
02
Suggestions

Add parts such as nodes, edges, branches, loops, or relationships that fit the current syntax.

Screen showing where to use Suggestions in Mermaid PreviewScreen showing where to use Suggestions in Mermaid Preview
03
History and draft

The browser keeps your current draft, and the history menu lets you return to a recent editing state.

Screen showing where to use History and draft in Mermaid PreviewScreen showing where to use History and draft in Mermaid Preview
04
Clear input

Remove the current syntax and start a new diagram.

Screen showing where to use Clear input in Mermaid PreviewScreen showing where to use Clear input in Mermaid Preview
05
Copy syntax

Copy the draft syntax into a README, specification, or external note.

Screen showing where to use Copy syntax in Mermaid PreviewScreen showing where to use Copy syntax in Mermaid Preview

03 HOWTO

Preview and theme area

Use the right preview pane to confirm the rendered Mermaid diagram and switch the theme before sharing. If rendering fails, the error appears in this same area.

Screen showing Preview and theme area in Mermaid PreviewScreen showing Preview and theme area in Mermaid Preview

What this area does

  • Switch the preview theme
  • Confirm the rendered diagram
  • Review rendering errors
  • Return to the input and revise the syntax

Where to use it

01
Switch theme

Change the background and line colors to match where the diagram will be shared.

Screen showing where to use Switch theme in Mermaid PreviewScreen showing where to use Switch theme in Mermaid Preview
02
Review diagram

Check whether the Mermaid syntax renders into the intended diagram.

Screen showing where to use Review diagram in Mermaid PreviewScreen showing where to use Review diagram in Mermaid Preview
03
Review errors

When the diagram cannot render, read the error message before editing the syntax.

Screen showing where to use Review errors in Mermaid PreviewScreen showing where to use Review errors in Mermaid Preview
04
Edit input

Use the preview result as feedback while revising the syntax in the editor.

Screen showing where to use Edit input in Mermaid PreviewScreen showing where to use Edit input in Mermaid Preview

04 HOWTO

Output format, copy, and download area

Use the output controls above the preview to choose SVG or PNG, then copy or download the rendered diagram. If export is not available, review the error and return to the input.

Screen showing Output format, copy, and download area in Mermaid PreviewScreen showing Output format, copy, and download area in Mermaid Preview

What this area does

  • Choose SVG or PNG as the output format
  • Copy the rendered diagram as an image
  • Download the rendered diagram as a file
  • Copy the original Mermaid syntax
  • Review errors when export is not possible

Where to use it

01
Output format

Switch between SVG and PNG depending on where you will share or paste the diagram.

Screen showing where to use Output format in Mermaid PreviewScreen showing where to use Output format in Mermaid Preview
02
Copy image

Copy the rendered diagram in the selected format and paste it into a document or chat.

Screen showing where to use Copy image in Mermaid PreviewScreen showing where to use Copy image in Mermaid Preview
03
Download image

Save the rendered diagram as an SVG or PNG file.

Screen showing where to use Download image in Mermaid PreviewScreen showing where to use Download image in Mermaid Preview
04
Copy syntax

Copy the Mermaid syntax used to create the diagram and share it with the image.

Screen showing where to use Copy syntax in Mermaid PreviewScreen showing where to use Copy syntax in Mermaid Preview
05
Review errors

When the diagram cannot be exported, check the error and return to the input.

Screen showing where to use Review errors in Mermaid PreviewScreen showing where to use Review errors in Mermaid Preview

Notes

Notes

Important points are grouped with reasons so you can make decisions before using the tool.

確認すること

まず図が表示される最小構成から書き始める

要素を一度に増やすとエラー原因が分かりにくくなります。まずは最小の記法で図が出ることを確認してから枝やノードを足すと崩れにくいです。

確認すること

テーマを切り替えて線や文字の見え方を確認する

同じ Mermaid 記法でも、背景と線色の見え方はテーマで変わります。共有先の見た目に近いテーマで確認すると、公開前の手戻りを減らせます。

確認すること

構文エラーはプレビュー下部に表示される

記法が正しくない場合、プレビューにエラーメッセージが表示されます。図が表示されない時はエラー内容を確認してから記法を修正してください。

確認すること

入力した記法はブラウザ内で図にする

図の描画はブラウザ内で行い、入力した記法を外部のサーバーへ送りません。社内向けの仕様を図にして確認したい時にも使えます。

FAQ

Questions about Mermaid Preview

Questions that make decisions easier before use are summarized first.

Can I save the diagram as an image?

Yes. You can save it as SVG or PNG, and you can both copy and download it.

Where do I see syntax errors?

An error message appears below the preview, so you can spot the broken part right away as you type.

Which diagram types can I use?

You can display the diagrams Mermaid supports out of the box, such as flowcharts, sequence diagrams, class diagrams, ER diagrams and Gantt charts.

Where can I look up the syntax?

The official Mermaid documentation explains the syntax for each diagram type. On this page, you can write the syntax and check the diagram at the same time.

Can I change the diagram's background color?

Switching the theme changes the whole style, background color included. Compare how the diagram looks in each theme and pick the one you like.

How do I share a diagram as an image?

Save it as SVG or PNG, then share the file. You can also copy it to the clipboard.

Next guides

Related guides

Related guides are listed next so you can continue without getting lost.