<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pastezap</title>
    <description>The latest articles on DEV Community by pastezap (@pastezap_tools).</description>
    <link>https://dev.to/pastezap_tools</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4197782%2F73862019-5538-443d-8316-8a0e1f344f22.png</url>
      <title>DEV Community: pastezap</title>
      <link>https://dev.to/pastezap_tools</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pastezap_tools"/>
    <language>en</language>
    <item>
      <title>How to Create a Flowchart from Text Using Mermaid (Free Browser Tutorial)</title>
      <dc:creator>pastezap</dc:creator>
      <pubDate>Wed, 21 Oct 2026 08:14:36 +0000</pubDate>
      <link>https://dev.to/pastezap_tools/how-to-create-a-flowchart-from-text-using-mermaid-free-browser-tutorial-445e</link>
      <guid>https://dev.to/pastezap_tools/how-to-create-a-flowchart-from-text-using-mermaid-free-browser-tutorial-445e</guid>
      <description>&lt;p&gt;Drawing flowcharts by dragging boxes around is slow, and the result is hard to update or review in a pull request. With &lt;a href="https://mermaid.js.org/" rel="noopener noreferrer"&gt;Mermaid&lt;/a&gt;, you write the flowchart as text and the layout is computed for you. The text lives next to your code, diffs cleanly and renders on GitHub, GitLab, Notion and Obsidian.&lt;/p&gt;

&lt;p&gt;In this tutorial we'll build a real flowchart step by step: a &lt;strong&gt;password-reset flow&lt;/strong&gt;, with a decision, a loop and a database step.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclosure: I built PasteZap, the free browser editor I use for the live preview below. Any Mermaid editor works the same way, since the syntax is standard Mermaid 11.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. The smallest possible flowchart
&lt;/h2&gt;

&lt;p&gt;Every Mermaid flowchart starts with &lt;code&gt;flowchart&lt;/code&gt; and a direction:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    A[Start] --&amp;gt; B[Do something]
    B --&amp;gt; C[End]&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;TD&lt;/code&gt; (or &lt;code&gt;TB&lt;/code&gt;) means top to bottom. You can also use &lt;code&gt;LR&lt;/code&gt; (left to right), &lt;code&gt;RL&lt;/code&gt; and &lt;code&gt;BT&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; are &lt;strong&gt;IDs&lt;/strong&gt;. The text in brackets is the &lt;strong&gt;label&lt;/strong&gt; shown in the box.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--&amp;gt;&lt;/code&gt; draws an arrow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once a node is declared, refer to it by its ID only: &lt;code&gt;B --&amp;gt; C&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Pick the right shape for each step
&lt;/h2&gt;

&lt;p&gt;The brackets around a label decide the shape. These are the ones you'll use most:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Shape&lt;/th&gt;
&lt;th&gt;Typical use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A[Text]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rectangle&lt;/td&gt;
&lt;td&gt;Process step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A(Text)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rounded rectangle&lt;/td&gt;
&lt;td&gt;Softer process step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A([Text])&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stadium&lt;/td&gt;
&lt;td&gt;Start / end&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A{Text}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Diamond&lt;/td&gt;
&lt;td&gt;Decision&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A[/Text/]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Parallelogram&lt;/td&gt;
&lt;td&gt;Input / output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A[(Text)]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cylinder&lt;/td&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A[[Text]]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Subroutine&lt;/td&gt;
&lt;td&gt;Call to another process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A((Text))&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Circle&lt;/td&gt;
&lt;td&gt;Connector&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Add decisions with labelled arrows
&lt;/h2&gt;

&lt;p&gt;A decision is a diamond with one arrow per answer. Put the answer between pipes, right after the arrow:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    C{Account exists?}
    C --&amp;gt;|Yes| D[Create one-time token]
    C --&amp;gt;|No| E[Show the same confirmation message]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Showing the &lt;em&gt;same&lt;/em&gt; message whether or not the account exists is deliberate: it stops attackers from using the form to find out which emails are registered. Flowcharts are a good place to make that kind of rule visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The complete password-reset flow
&lt;/h2&gt;

&lt;p&gt;Here is the full example. It has a decision, a retry loop when the link expires and another loop when the new password is rejected:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    A([User clicks Forgot password]) --&amp;gt; B[/Enter email address/]
    B --&amp;gt; C{Account exists?}
    C --&amp;gt;|Yes| D[Create one-time token]
    C --&amp;gt;|No| E[Show the same confirmation message]
    D --&amp;gt; F[Send reset email]
    F --&amp;gt; E
    E --&amp;gt; G{Link opened within 30 min?}
    G --&amp;gt;|No| H[Token expires]
    H --&amp;gt; B
    G --&amp;gt;|Yes| I[/Enter new password/]
    I --&amp;gt; J{Meets password policy?}
    J --&amp;gt;|No| I
    J --&amp;gt;|Yes| K[(Update users table)]
    K --&amp;gt; L([Done])&lt;/code&gt;&lt;/pre&gt;



&lt;blockquote&gt;
&lt;p&gt;📷 &lt;strong&gt;[Upload the exported PNG here with the image button of the editor]&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Loops need no special syntax: &lt;code&gt;H --&amp;gt; B&lt;/code&gt; and &lt;code&gt;J --&amp;gt;|No| I&lt;/code&gt; simply point back to an earlier step, and Mermaid routes the arrow for you.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://pastezap.com/tools/flowchart-maker/#mmd=TVHLboMwELz3K_aYHKJU6r1VEsi7vSQ5VBYHFzbBArzI3ohW0H-vsSmKT7ZmdmZ2fC2pSXNpGM7RE7izmIiLRQNpqdLCwprMjRhqaW1DJkumMJu9wlLMY82OhZVUJcgsM2jtPPEKS09ZtYs0pbtmwG9l2b79enDVg90n2g4isTIoGYE0zlhVCEwF6iASeB_UQSxOOTXAOYKVjpSSvipTSVakoXK28oZhJvLGa3FCnYELhM67zxfQtUdjf4_9fdMelS6AatSYQaM4VxpenqFSeki7GVNsxbkP55aplZMOkttQxgPVL7b7b0djMzY3lLPzI_v2HZHtCEJNru6fwXU_uu4e3l76ICaXOutLu7tPssDyq8RpkD546eNERK7QZPoH" rel="noopener noreferrer"&gt;open this exact diagram in a live editor&lt;/a&gt;: the whole diagram is stored in the part of the link after &lt;code&gt;#&lt;/code&gt;, which browsers don't send to the server.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Change the arrow style
&lt;/h2&gt;

&lt;p&gt;Different arrows help separate the main path from exceptions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Arrow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Solid arrow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-.-&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dotted arrow (optional or async step)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;==&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Thick arrow (main path)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;---&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line without arrowhead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--o&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Circle end&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cross end&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, make the happy path stand out with &lt;code&gt;C ==&amp;gt;|Yes| D&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Common errors and how to fix them
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;end&lt;/code&gt; breaks the diagram.&lt;/strong&gt; A node labelled with the lowercase word &lt;code&gt;end&lt;/code&gt; closes a block in Mermaid's parser. Write &lt;code&gt;End&lt;/code&gt;, &lt;code&gt;Done&lt;/code&gt; or wrap it in quotes: &lt;code&gt;Z["end"]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Special characters in labels.&lt;/strong&gt; Parentheses, brackets or quotes inside a label confuse the parser. Wrap the label in double quotes: &lt;code&gt;A["Check (optional) fields"]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reusing an ID with a new label.&lt;/strong&gt; &lt;code&gt;A[Start]&lt;/code&gt; and later &lt;code&gt;A[Begin]&lt;/code&gt; refer to the &lt;em&gt;same&lt;/em&gt; node; the last label wins. Use a new ID for a new step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagram too wide.&lt;/strong&gt; Switch &lt;code&gt;TD&lt;/code&gt; to &lt;code&gt;LR&lt;/code&gt; (or the other way around) before trying anything more complex.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Put it in your README
&lt;/h2&gt;

&lt;p&gt;GitHub and GitLab render Mermaid code blocks directly. Paste the diagram in a fenced code block whose language is &lt;strong&gt;mermaid&lt;/strong&gt; (three backticks followed by the word mermaid), and it appears as a picture in the README, issue or pull request.&lt;/p&gt;

&lt;p&gt;For slides or docs that don't support Mermaid, export the flowchart as SVG (sharp at any size) or PNG.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Write the flow you're working on right now as text: a signup, a deployment, an order process. If you'd like a live preview while you type, &lt;a href="https://pastezap.com/tools/flowchart-maker/" rel="noopener noreferrer"&gt;PasteZap's Flowchart Maker&lt;/a&gt; is free, needs no account and renders the diagram in your browser. It also has a form to add steps one by one if you don't want to write the syntax yet.&lt;/p&gt;

&lt;p&gt;What flows do you document with Mermaid? I'd be glad to hear which diagram types you'd like covered next.&lt;/p&gt;

</description>
      <category>mermaid</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
