Mermaid diagrams to PDF

Paste Markdown with mermaid code blocks and download a PDF with every flowchart, sequence diagram and chart drawn in place. Free, and your document never leaves your browser.

Markdown
Preview

How it works

  1. Add your Markdown. Paste it, open a .md file, or drag one onto the page. Diagrams go in code blocks named mermaid, the same way GitHub, GitLab and Obsidian expect them.
  2. Check the preview. Diagrams are drawn as you type. If one has a mistake, its code stays visible with the error above it.
  3. Click Download PDF and choose Save as PDF in the print dialog. Diagrams are vector graphics, so they stay sharp at any zoom and never split across pages.

Diagrams are greyscale in the Classic, Academic and Résumé styles, which suit printing, drawn in the accent color of the Modern and Report styles, and in full color in the GitHub style, matching how they look on github.com. Worksheet and the themed styles draw them in their own colors.

Mermaid cheat sheet

The diagram types people use most. Click Try it to load an example into the editor (it replaces what's there), or copy it, fences included, into your own Markdown. Each type has a full guide of its own:

The Mermaid documentation covers every option and the other diagram types, such as mind maps and timelines.

Flowchart

Boxes and arrows. LR lays it out left to right, TD top down. The bracket style sets the shape: [box], (rounded), {decision}, [(database)].

```mermaid
flowchart TD
  Start([Order received]) --> Stock{In stock?}
  Stock -- Yes --> Ship[Ship the order]
  Stock -- No --> Notify[Email the customer]
  Ship --> Done([Done])
  Notify --> Done
```

Flowchart guide

Sequence diagram

Messages between people or systems over time. ->> is a solid arrow, -->> a dashed reply.

```mermaid
sequenceDiagram
  participant U as User
  participant A as App
  participant S as Server
  U->>A: Click "Sign in"
  A->>S: POST /login
  S-->>A: 200 OK and a token
  A-->>U: Show the dashboard
```

Sequence diagram guide

Gantt chart

Project schedules. Tasks can start on a date or after another task; done and milestone change how a task is drawn.

```mermaid
gantt
  title Website relaunch
  dateFormat YYYY-MM-DD
  section Design
  Wireframes     :done, w1, 2026-11-02, 5d
  Visual design  :w2, after w1, 7d
  section Build
  Development    :b1, after w2, 14d
  Launch         :milestone, after b1, 0d
```

Gantt chart guide

Class diagram

Classes with their fields and methods. <|-- means "inherits from".

```mermaid
classDiagram
  class Animal {
    +String name
    +speak() void
  }
  class Dog {
    +fetch() void
  }
  Animal <|-- Dog
  Animal <|-- Cat
```

Class diagram guide

State diagram

The states something moves through. [*] is the start on the left of an arrow and the end on the right; the text after the colon says what causes each move.

```mermaid
stateDiagram-v2
  [*] --> Draft
  Draft --> Review : Submit
  Review --> Draft : Changes requested
  Review --> Published : Approve
  Published --> [*]
```

State diagram guide

Entity relationship diagram

Database tables and how they relate. ||--o{ reads "one to zero or more".

```mermaid
erDiagram
  CUSTOMER ||--o{ ORDER : places
  ORDER ||--|{ LINE_ITEM : contains
  PRODUCT ||--o{ LINE_ITEM : "appears in"
```

ER diagram guide

Pie chart

A title, then one line per slice. Mermaid works out the percentages.

```mermaid
pie title Where the week goes
  "Meetings" : 12
  "Building" : 20
  "Reviews" : 8
```

Frequently asked questions

My diagram shows up as code. What's wrong?

The code block must be named mermaid: three backticks followed by the word mermaid on the opening line. If it is, look for the red error above the code in the preview; it gives the line of the diagram Mermaid couldn't read.

Does it work with diagrams from ChatGPT or Claude?

Yes. When you ask an AI assistant for a flowchart or diagram, it usually answers with a mermaid code block. Copy the answer with the assistant's copy button and paste it here. See saving AI answers as PDF.

Can I get diagrams in color?

Choose the GitHub style for full color, Worksheet or a themed style for their own colors, or Modern or Report for diagrams in their blue accent. Classic, Academic and Résumé draw diagrams in shades of grey to print well in black and white.

Is my document uploaded to draw the diagrams?

No. Mermaid runs inside your browser, like the rest of the converter. Nothing you type or open is sent anywhere.

A diagram is too small to read in the PDF.

Wide diagrams are shrunk to fit the page width. Switching a flowchart from LR to TD makes it taller and narrower, so it can be drawn larger.

Read the Markdown guide