Flowchart TD online

flowchart TD is the line Mermaid’s current documentation uses to start a flowchart and lay it out from top to bottom.

If a README still says graph TD, leave it. Both keywords draw the same top-down layout. Reach for flowchart TD when you are writing a new diagram and want the keyword the docs use now.

This page is the short version: the direction token, the node shapes, and one example you can edit in the free online editor. Sequence diagrams, class diagrams and the other types stay on the syntax guide.

Editable example

Change any label in the text box, then open the live editor to see the preview and export. The link below opens this flowchart TD example even if you do not change the box.

flowchart TD
    A[Receive request] --> B{Complete?}
    B -->|Yes| C[Draw flowchart TD]
    B -->|No| D[Add the missing step]
    D --> B
    C --> E[Share a link]

The link opens the example printed above. If you change the text box, the button sends your edited copy to the editor instead.

Edit this flowchart TD example in the free Mermaid editor

Syntax cheat sheet

flowchart TD uses the same node and arrow syntax as graph TD. Only the first keyword differs.

Mermaid flowchart syntax
SyntaxMeaning
graph TDStart a top-down flowchart. graph is the older keyword, and it still renders.
flowchart TDStart a top-down flowchart with the keyword used in the current Mermaid documentation.
TD / TB / BT / LR / RLDirection after the keyword: top-down, top-to-bottom, bottom-to-top, left-to-right, or right-to-left.
A[Text]A rectangular step.
B{Text}A decision diamond.
C(Text)A rounded node.
A --> BAn arrow from A to B.
A -->|Yes| BAn arrow with a label on it.
A["Text (note)"]Put quotes around a label that contains parentheses or other punctuation.

flowchart TD and graph TD

flowchart is the keyword in the current Mermaid documentation. graph is the older alias. With TD after either keyword, Mermaid draws a top-down flowchart and the layout matches.

You do not have to migrate old graph TD diagrams. Change the keyword only when you want new code to follow the current docs. For a sideways process, write flowchart LR instead of flowchart TD.

graph TD compared with flowchart TD
Comparisongraph TDflowchart TD
Keywordgraph, an older alias that still rendersflowchart, the keyword in the current docs
DirectionTD, top to bottomTD, top to bottom
LayoutTop-down flowchartThe same top-down flowchart
When to use itKeep it on diagrams you already havePrefer it when you write a new diagram

How to write a flowchart TD diagram

Create a top-down Mermaid flowchart with flowchart TD, check the live preview, and export or share it.

  1. Declare flowchart TD. Put flowchart TD on the first line so Mermaid treats the rest of the file as a top-down flowchart.
  2. Describe each step. Add rectangle steps with square brackets, decisions with curly braces, and arrows with -->. Label a branch with -->|Yes| or -->|No|.
  3. Open the live preview and export. Open the example in the editor. The preview updates as you edit. Export PNG, SVG or PDF, or share a link that carries the code without uploading it.

FAQ

What does flowchart TD mean?

flowchart starts a Mermaid flowchart, and TD means top-down. It sets the overall layout direction; branches and loops can still point in other directions. Use LR, RL or BT for a different overall direction.

Should I replace graph TD with flowchart TD?

Only if you want the keyword from the current Mermaid documentation. graph TD still renders the same top-down layout, so existing diagrams do not need a rewrite.

Which directions can a flowchart use?

TD and TB are top to bottom, BT is bottom to top, LR is left to right, and RL is right to left. The example on this page uses TD.

Do I need an account to draw a flowchart TD diagram here?

No. The editor, the live preview, PNG, SVG and PDF export, and share links are free and do not ask you to sign up. The diagram renders in your browser.

Stay on flowchart TD, or open the alias, the broader flowchart page, and the editor.