Toolvito

Read and drawn in your browser · Nothing is sent

Code Flowchart Generator

Paste a function, choose its language and press Make the flowchart. Each decision becomes a diamond with yes and no arrows, loops go back to their test, and returns lead to the end. The flowchart is drawn in your browser; change it as text if you like, then download it.

Your code

Its name, such as main. Empty: main, the code outside functions, or the first function.

The flowchart

One arrow or a chain of arrows on each line, with a space on both sides: Order -> Pack -> Ship. Words on an arrow: Paid? -- yes --> Ship. (Start) is a rounded box; a line that ends in ? is a decision. Lines without arrows are steps in order.

The words of the flowchart are in the text box.

How to make a flowchart from code

  1. Paste or type your code into Your code and choose its Language. For pseudo code, write it like Python: if, while and for lines that end with a colon, and the steps under them indented.
  2. If the code has several functions, type the name of the one you want under Function (for example main or Shop.checkout). Left empty, the page draws main if there is one, otherwise the code outside functions, otherwise the first function.
  3. Press Make the flowchart. The message under the button lists the functions it found.
  4. The flowchart appears in the editor below as Mermaid text. Change the words or the arrows there if you like; the drawing follows as you type.
  5. Choose Top to bottom or Left to right, then Download SVG (sharp at any size, for Word or slides), Download PNG or Download Mermaid.

How the code becomes a flowchart

  • Start and End are rounded boxes; the start box shows the function and its parameters.
  • Decisions (if, else if, elif) are diamonds with yes and no arrows; switch, match and when are one diamond with an arrow for each case.
  • Loops (for, while, do … while) are a diamond that the body goes back to; break leaves the loop, continue goes back to its test.
  • Errors: try leads to “when an error happens”, which leads to each catch or except; throw and raise go there too.
  • Up to three plain statements in a row share one box, so that the chart stays readable. A function defined inside the code is one box; draw it on its own by typing its name.

Limits you should know

  • The page reads the structure of the code; it does not run it, compile it or check that it is correct. Unusual syntax (macros, goto, generators, async details) is drawn as plain boxes.
  • A finally block is drawn after the normal path and the error path, not after every return.
  • At most 80 boxes: for long code, draw one function at a time.
  • This page draws code as a flowchart; it does not write code from a flowchart.

Where your code goes

Nowhere: the code is read and drawn in your browser. It is kept in this browser as a draft so that you can come back to it (choose another example or clear the box to remove it).

Related tools