How to read Mermaid diagrams without reading the code

Your AI drew you a flowchart, but you got arrows made of dashes. Here is how to read Mermaid when you have to, and how to see the picture instead.

The short answer

Mermaid is a way of writing diagrams as text inside a Markdown file: a code block labeled mermaid holds a flowchart, timeline, pie chart or other diagram, and its first word (graph, gantt, pie, sequenceDiagram) tells you which type. To see it as a picture, open the file in an app that draws Mermaid. Without one, read the arrows as "goes to" and the brackets as boxes.

Why does my AI diagram show as code instead of a picture?

An AI diagram shows as code because Claude or ChatGPT wrote it in Mermaid, a small text language for diagrams, and the app you opened it in doesn't draw Mermaid. You asked for a map of a process, and somewhere in the answer you got this:

Raw .md
graph LR
  A[Idea] --> B[Draft]
  B --> C{Approved?}
  C -->|yes| D[Publish]
  C -->|no| B
In a reader
A Mermaid flowchart, as the AI wrote it and as a reader draws it.

On top is what's actually in the file. Underneath is what it's meant to look like. The Mermaid text on top is complete and working: a set of instructions for drawing the picture underneath.

AI tools use Mermaid because they can't attach an image to a text file, but they can write text that describes an image. Any app that understands Mermaid turns that text into boxes, arrows and labels. Apps that don't, show you the recipe. (If the .md file itself is new to you, start with what a .md file is.)

Where does Mermaid come from?

Mermaid is an open-source project Knut Sveidqvist started in 2014 so diagrams in documentation could be updated as easily as the text around them (Wikipedia). Instead of redrawing a flowchart in a design tool every time a step changes, you edit one line of text.

Mermaid spread when popular platforms began drawing it automatically. GitHub has drawn Mermaid blocks in Markdown files since 2022 (GitHub blog), and many documentation tools and Markdown apps now support it. That's why AI tools, which learned from a lot of technical writing, reach for Mermaid so readily.

How do I spot a Mermaid diagram in a .md file?

In a raw .md file, a Mermaid diagram always sits inside a fenced code block that names the language:

TEXT
    ```mermaid
    graph TD
      A[Start] --> B[Finish]
    ```

Three backticks, the word mermaid, then the diagram, then three backticks to close. If you see that, everything until the closing backticks is one diagram.

The first line inside the block tells you what kind of diagram it is. That single word is the most useful thing to read first. This table lists the first lines you'll meet and the diagram each one starts.

First lineDiagram typeWhat it shows
graph TD, graph LR, flowchart TDFlowchartSteps, decisions and where each one leads
sequenceDiagramSequence diagramWho sends what to whom, in order
ganttGantt chartTasks on a timeline, with start dates and lengths
piePie chartHow a whole splits into parts
timelineTimelineEvents grouped by period
journeyUser journeySteps a person takes, with how each one feels
mindmapMind mapIdeas branching from a central topic
stateDiagram-v2State diagramThe states something can be in and how it moves between them
erDiagramEntity relationship diagramHow pieces of data relate
classDiagramClass diagramHow parts of a program are structured
quadrantChartQuadrant chartItems plotted on two axes
gitGraphGit graphBranches and merges in a code history

For most people using AI for planning and writing, the first five diagram types cover almost everything you'll meet. The rest show up mainly in technical work.

How do I read a Mermaid flowchart as text?

You read a Mermaid flowchart as text by looking at four things: the direction, the boxes, the arrows and the loops. Flowcharts are by far the most common diagram AI tools write, so these four cover most of what you'll see.

1. The direction

The letters after graph or flowchart say which way the chart flows:

CodeDirection
TD or TBTop to bottom
LRLeft to right
BTBottom to top
RLRight to left

This doesn't change the meaning, only the layout. TD charts read like a list of steps down the page. LR charts read like a sentence.

2. The boxes

Each box has a short ID and a label. The ID is how the rest of the diagram refers to it. The brackets around the label set the shape, as this table shows.

Written asShapeUsually means
A[Label]RectangleA step or action
A(Label)Rounded rectangleA softer step, often a start or end
A{Label}DiamondA decision or question
A((Label))CircleA start, end or key point
A[(Label)]CylinderA database or stored data
A>Label]FlagA note or signal

When you're reading, you can mostly ignore the IDs. Read the words inside the brackets, and let the bracket shape tell you if it's a question.

3. The arrows

Arrows connect boxes. Read each arrow as goes to or leads to. This table shows the arrow styles you'll see.

Written asWhat it draws
A --> BArrow from A to B
A --- BA plain line, no arrowhead
A -.-> BDotted arrow, often an optional or indirect step
A ==> BThick arrow, often the main path
`A -->yes
A -- yes --> BAnother way of labeling an arrow

So C -->|no| B means from C, if the answer is no, go back to B.

4. The loops

When an arrow points back to an earlier box, that's a loop: a step that repeats until something changes. In the example at the top, C -->|no| B sends you back to drafting until the answer is yes.

Loops are where raw flowcharts are hardest to follow, because your eyes have to jump back up the text to find the box. Drawn, they're obvious.

Putting it together

Here's a slightly longer one, the kind an AI might write for a hiring process.

Raw .md
flowchart TD
  A([Application in]) --> B[Screen CV]
  B --> C{Good fit?}
  C -->|no| X([Send polite no])
  C -->|yes| D[Phone call]
  D --> E{Still keen?}
  E -->|yes| F[Paid task]
  E -->|no| X
  F --> G([Offer])
In a reader
Read the words in brackets, then follow the arrows.

Read as text, you'd say: An application comes in. Screen the CV. Is it a good fit? If not, send a polite no. If yes, have a phone call. Still keen? If yes, set a paid task, then make an offer. If not, send a polite no.

That's a completely readable process, but it took some translation. The drawing needs none.

Good to know

Many flowcharts also group boxes with a subgraph line and an end line. Everything between them is drawn inside a labeled frame. Read the subgraph name as a section heading.

How do I read a Mermaid Gantt chart as text?

A Mermaid Gantt chart is readable as text once you know that each task line is a name, an optional status, a start and a length. AI tools love Gantt charts for project plans.

Raw .md
gantt
  title Launch plan
  dateFormat YYYY-MM-DD
  section Build
  Reader   :done,   2026-09-01, 14d
  Search   :active, 2026-09-10, 10d
  section Ship
  Beta     :2026-09-22, 7d
  Launch   :milestone, 2026-10-01, 0d
In a reader
Each task line is a name, an optional status, a start and a length.

Here's how to read each line:

  • title is the chart's name.
  • dateFormat tells the chart how dates are written. You can skip it.
  • section starts a group of tasks. Read it like a heading.
  • Each task line is name, then a colon, then details separated by commas.
  • done, active and crit (critical) are statuses. They change the bar's color.
  • A date is when the task starts. 14d means it lasts fourteen days.
  • milestone with 0d marks a single moment, like a launch day.

Sometimes a task starts after another one, like Beta :after Search, 7d. That means start when Search finishes, last seven days. This is where text gets hard: to know when Beta happens, you have to find Search, work out when it ends, and add. A drawn chart does that arithmetic for you.

How do I read a Mermaid pie chart as text?

A Mermaid pie chart is the simplest diagram to read as text: each line is a label and a number.

Raw .md
pie title Where the week went
  "Hunting for files" : 42
  "Fixing formatting" : 27
  "Actually reading" : 31
In a reader
Labels in quotes, values after the colon.

The label sits in quotes and the number follows the colon. The numbers don't have to add up to 100. Mermaid works out each slice's share of the total. To read it as text, add the numbers and compare each one to the total.

How do I read a Mermaid sequence diagram?

A Mermaid sequence diagram shows a conversation between people or systems, in order. They appear when an AI explains how something works step by step.

Raw .md
sequenceDiagram
  participant You
  participant Claude
  participant Mac
  You->>Claude: Write the launch plan
  Claude->>Mac: Save launch-plan.md
  Mac-->>Claude: Saved
  Claude-->>You: Done, here is the path
In a reader
Each arrow is one message, read from top to bottom.
  • participant lines list who's involved, left to right.
  • A->>B: message is a message from A to B. Solid arrows are requests.
  • -->> with two dashes is a dotted reply.
  • Read the arrow lines top to bottom, like a script.

What other Mermaid diagrams might an AI write?

Mind maps, user journeys and state diagrams turn up less often in AI answers, and each one has one simple rule for reading it.

Mind maps

Raw .md
mindmap
  root((Launch))
    Website
      Hero
      Pricing
    App
      Search
      Themes
In a reader
Indentation shows which idea branches from which.

In a mind map, indentation does all the work. Each line indented under another branches from it. This is similar to a nested list, and just as hard to follow when it gets deep.

User journeys

A journey diagram lists steps a person takes, each with a score from 1 to 5 for how it feels and who's involved. Read each step as a line in a story and treat the number as a mood: 5 is great, 1 is painful. They're useful for spotting the worst moment in an experience at a glance, which is exactly what's hard to see in text.

State diagrams

A state diagram shows what state something is in and what moves it between states. [*] --> Draft means it starts as a draft. Draft --> Review : submit means submitting moves it from Draft to Review. Read each arrow as a rule.

How do I use a Mermaid diagram to check the AI's process?

A drawn Mermaid diagram is the quickest way to check whether the AI understood your process, because gaps you'd miss in text jump out in a picture. Say you asked for a refund process and got this:

Raw .md
flowchart TD
  A([Refund request]) --> B{Within 30 days?}
  B -->|yes| C[Refund in full]
  B -->|no| D{Faulty?}
  D -->|yes| C
  C --> E([Email receipt])
In a reader
Drawn, the gap in this process is obvious.

Read as text, it looks complete. Drawn, you notice straight away that the no branch from Faulty? goes nowhere. What happens to a customer who asks after 30 days for something that isn't faulty? The AI didn't say.

That's the real value of seeing the diagram: missing arrows, dead ends and loops that never exit are visible at a glance, and invisible in text. When you spot one, tell the AI exactly what's missing: Add what happens when the item isn't faulty and it's past 30 days.

A quick checklist for any flowchart:

0 of 4
  • Does every diamond have an arrow for each answer? (to do)
  • Does every path reach an end? (to do)
  • Is there a loop that can never exit? (to do)
  • Are there two boxes that mean the same thing? (to do)

What patterns do AI tools use in Mermaid diagrams?

AI tools reach for the same six shapes in Mermaid diagrams again and again, and recognizing them makes even raw diagrams quicker to read. This table names each pattern and what it tells you.

PatternWhat it looks likeWhat it's telling you
PipelineA straight line of boxes, A to B to CA fixed sequence of steps
GateA diamond with yes and no branchesA decision that changes what happens next
Retry loopAn arrow pointing back to an earlier boxSomething repeats until it passes
Fan outOne box with arrows to several boxesWork that splits, often done in parallel
Fan inSeveral boxes pointing to oneParts that come together before moving on
Swim lanesSubgraphs labeled with people or teamsWho is responsible for which steps

If you can name the pattern, you can often understand the diagram from its first few lines without reading the rest.

What do classDef and style lines mean in a Mermaid diagram?

Lines like classDef done fill:#DDEFDD or style C fill:#FDE7EC at the bottom of a Mermaid diagram only set colors. They don't change the diagram's shape, so when you read raw Mermaid you can skip them.

Color is worth asking for, though. A flowchart where finished steps are green and blocked ones are red is far quicker to read than a gray one. Our guide to adding color to Mermaid diagrams shows every method, with prompts to paste into Claude or ChatGPT.

Why won't my Mermaid diagram draw?

A Mermaid diagram that won't draw, even in an app that supports Mermaid, usually has one of five causes. This table matches what you see to the likely cause and the fix.

What you seeLikely causeWhat to try
The code, with no drawing at allThe app doesn't support MermaidOpen it in an app that does
A "syntax error" messageOne line is written slightly wrongNote the line number if the app gives one, and ask the AI to fix that line
An error that points at a box labelThe label contains a character Mermaid treats as code, like brackets or quotesAsk the AI to wrap labels in double quotes
A newer diagram type shows as an errorThe app uses an older version of MermaidAsk for a flowchart version instead
It's drawn but tiny or cut offThe diagram is very wideAsk for TD instead of LR, or split it in two

AI-written Mermaid is usually valid, but long diagrams sometimes contain a small mistake. The quickest fix is to paste the error back to the AI and ask it to correct the block. A line number makes that much faster: Line 7 of the refund diagram has a syntax error. Fix it.

How do I ask Claude or ChatGPT for easier-to-read diagrams?

Five short instructions make Mermaid diagrams from Claude or ChatGPT easier to read, drawn or not:

  • Ask for top-to-bottom. Use flowchart TD. Tall diagrams fit pages better than wide ones.
  • Ask for short labels. Keep each box under five words. Long labels make boxes huge.
  • Ask for one idea per diagram. Two small diagrams beat one giant one.
  • Ask for a text summary too. Add a numbered list of the steps below the diagram. Then you have both.
  • Name the type. If you want a timeline, say Gantt chart. If you want proportions, say pie chart.

For more ways to make AI documents easier to take in, see reading AI documents when you think in pictures.

How do I see Mermaid diagrams drawn on a Mac?

To see Mermaid diagrams drawn on a Mac, open the .md file in an app that draws Mermaid, and you won't need to read any of the code. Your options (checked 28 September 2026):

  • GitHub draws Mermaid in .md files you view on its website. Useful if your files are already there, but you'd need to upload them.
  • Editors and note apps draw it, including Typora, Obsidian and Marked. VS Code's built-in Markdown preview now draws Mermaid too (VS Code docs).
  • One Clear Reader draws Mermaid diagrams in the reading view, locally on your Mac, with no internet needed. Paste the path your AI gave you, or type part of the file name, and flowcharts, timelines and charts appear as pictures.

A few things in One Clear Reader help with the diagram problems above. Diagrams that don't set their own colors follow the page, so they stay readable when you switch to a dark page. If a diagram won't draw, you get a plain message such as This diagram has a syntax error on line 7, with the diagram code shown underneath, ready to copy back to your AI. Full View gives wide diagrams the whole screen. With Pro, Expand opens a diagram full size with zoom from 25% to 400%, and Copy SVG copies the drawing as SVG code, which design tools like Figma can paste in as a picture.

For every way to open the file in the first place, see how to open a .md file on a Mac.

Questions people ask

What is Mermaid in Markdown?

Mermaid is a text format for describing diagrams. You write it inside a code block marked mermaid, and apps that support it draw the diagram instead of showing the text.

Why do Claude and ChatGPT write diagrams as code?

Claude and ChatGPT write text, and Mermaid lets them describe a diagram in text, so the diagram can live inside a Markdown file and be edited like any other line.

Which Mac apps draw Mermaid diagrams?

One Clear Reader, Typora, Obsidian, Marked and VS Code's Markdown preview draw Mermaid diagrams from a .md file. TextEdit and Quick Look show only the code.

What does graph TD mean in a Mermaid diagram?

graph TD starts a Mermaid flowchart that flows top to bottom. graph LR starts one that flows left to right.

Can I edit a Mermaid diagram in a .md file myself?

Yes, you can edit a Mermaid diagram in any text editor. Change the words inside the brackets to rename a box, or add a line like B --> E to add an arrow. Keep the brackets and arrows intact so it still draws.

Do Mermaid diagrams need the internet to draw?

No, not if the app includes Mermaid itself. One Clear Reader draws diagrams on your Mac with no connection, so the file never leaves your computer.

Keep reading

Stop reading code soup.
Free version forever. Every Pro feature free for 30 days. No card.
Download free for Mac