Reference · Flowchart symbols for programming

Programming flowchart symbols: the shapes for drawing an algorithm

In short

Programming flowchart symbols are the shapes used to draw an algorithm before it is coded: an oval terminal for Start and End, a rectangle for a calculation or assignment, a parallelogram for input and output, a diamond for a condition, a hexagon for loop preparation, a double-sided rectangle for a subroutine call and arrows for the flow of control. With them every program is built from three structures: sequence, selection (if) and iteration (loops).

Updated · by the ChartCraft team · drawings rendered with Mermaid 11.17.2 · part of the flowchart symbols reference

What are the programming flowchart symbols?

Ten symbols are used in program flowcharts. ISO 5807 describes a program flowchart as process symbols for the operations, including the symbols that choose a path by a logical condition, and line symbols for the flow of control.

SymbolNameIn codeMermaid
Terminal symbol of a program flowchart: a rounded shape labelled StartTerminalThe start and end of the program or functionA([Start])
Process symbol: a rectangle holding the assignment total = total + markProcessAn assignment or calculation: total = total + markA[total = total + mark]
Input/output symbol: a parallelogram labelled Read markInput/outputinput(), print(), reading a fileA[/Read mark/]
Decision symbol: a diamond holding the condition count > 0?Decisionif, while or until condition with a true and a false exitA{count > 0?}
Flow line: an arrow from the process count = 0 to the input Read markFlow lineThe order statements run inA[count = 0] --> B[/Read mark/]
Preparation symbol: a hexagon holding the loop header i = 1 to 10PreparationSetting up a loop: for i = 1 to 10A{{i = 1 to 10}}
Loop limit symbol: a rectangle with the two top corners cut off, labelled For each markLoop limitStart (and a matching end) of a loop, used in pairsA@{ shape: notch-pent, label: "For each mark" }
Predefined process symbol: a rectangle with double sides labelled average of marksPredefined processCalling a function or procedure defined elsewhereA[[average of marks]]
Connector symbol: a small circle with the letter AConnectorContinues the flow at the circle with the same letterA((A))
Annotation symbol: an open brace next to the comment -1 ends the listAnnotationA commentA@{ shape: brace, label: "-1 ends the list" }

Exam boards and textbooks differ on the extra symbols. Many courses accept only the first five plus the subroutine box; others teach the hexagon for for-loops. Use what your syllabus shows. Each basic symbol has its own page, for example the decision symbol and the loop symbol.

How are sequence, selection and iteration drawn?

Every algorithm is built from three structures. A sequence is boxes in a line. Selection is a diamond whose two branches join again. Iteration is a diamond with an arrow that goes back up.

StructureDrawingCodeRead it out loud
SequenceSequence: an input, a calculation and an output, one after the otherprice = input()
tax = price * 0.2
print(price + tax)
Read the price, work out the tax, print the total.
Selection (if-else)Selection: a decision with a Yes branch and a No branch that join againif mark >= 50:
print("Pass")
else:
print("Fail")
If the mark is at least 50, print Pass, otherwise print Fail, then carry on.
Iteration, test first (while)Iteration: a decision tested before the loop body, with an arrow from the end of the body back to the decisioncount = 1
while count <= 3:
print(count)
count = count + 1
While count is at most 3, print it and add one. When the test is false, leave the loop.
Iteration, test last (repeat until)Iteration with the test after the body: the input runs once, then a decision sends the flow back until the password is validrepeat
password = input()
until valid(password)
Read a password, and keep reading until it is valid. The body always runs at least once.
Subroutine callSubroutine call: a predefined process symbol between an input and an outputmarks = read_marks()
avg = average(marks)
print(avg)
Read the marks, call average, print the result.

How do you turn an algorithm into a flowchart step by step?

Task: read exam marks until the user types -1, then print the average. Build it in three steps, testing each version with a few numbers.

Step 1

Write the straight sequence

Start, set the total and count to zero, read one mark, add it, print the average, end. This works for exactly one mark.

Step 1: a straight sequence that reads one mark and prints the average
A sequence that handles one mark. Rendered with Mermaid 11.17.2 from the code below.
flowchart TD
    S([Start]) --> I[total = 0, count = 0]
    I --> R[/Read mark/]
    R --> U[total = total + mark, count = count + 1]
    U --> P[/"Print total / count"/]
    P --> E([End])

Step 2

Add the loop

After reading a mark, ask mark = -1? On No, add the mark and go back to read the next one. On Yes, leave the loop and print. The arrow goes back to the input, so each pass reads a new mark.

Step 2: a decision and a return arrow turn the sequence into a loop that reads marks until -1
A sentinel loop that stops at -1. Rendered with Mermaid 11.17.2 from the code below.
flowchart TD
    S([Start]) --> I[total = 0, count = 0]
    I --> R[/Read mark/]
    R --> D{mark = -1?}
    D -->|No| U[total = total + mark, count = count + 1]
    U --> R
    D -->|Yes| P[/"Print total / count"/]
    P --> E([End])

Step 3

Guard the division

Trace it with -1 as the first input: count is 0 and the program would divide by zero. Add a second decision before printing.

Step 3: a second decision checks that count is greater than 0 before dividing
The finished algorithm with the divide-by-zero check. Rendered with Mermaid 11.17.2 from the code below.
flowchart TD
    S([Start]) --> I[total = 0, count = 0]
    I --> R[/Read mark/]
    R --> D{mark = -1?}
    D -->|No| U[total = total + mark, count = count + 1]
    U --> R
    D -->|Yes| C{count > 0?}
    C -->|Yes| P[/"Print total / count"/]
    C -->|No| N[/Print No marks/]
    P --> E([End])
    N --> E

Draw this in the editor → Opens ChartCraft with this description filled in: “Program flowchart that reads marks until -1 is entered, adds them up and counts them, then prints the average, or prints No marks if none were entered.”

How do you check a program flowchart with a trace table?

Follow the arrows with sample input and write down every variable each time it changes. If the last row matches the answer you worked out by hand, the flowchart is right for that input.

Inputmark = -1?totalcountOutput
00
60No601
70No1302
-1Yes130265

Which programming flowchart mistakes lose marks?

Four mistakes cost the most marks in computing exams.

1. Input drawn in a process box

Loses marks

Wrong: the input Read mark is drawn in a process rectangle

A[Read mark] --> B[total = total + mark]

Correct

Right: the input Read mark is drawn in a parallelogram

A[/Read mark/] --> B[total = total + mark]

Reading and printing are input/output and go in a parallelogram. Rectangles are for calculations.

2. A decision with one exit

Loses marks

Wrong: a decision diamond with a single unlabelled exit

Correct

Right: a decision diamond with a No exit and a Yes exit

A condition is true or false, so a diamond always has two exits, each labelled.

3. The loop goes back to the wrong place

Loses marks

Wrong: the return arrow goes back to the decision, so no new mark is read and the loop never ends

Correct

Right: the return arrow goes back to the input, so each pass reads the next mark

If the arrow returns to the decision, the same mark is tested forever. Return to the step that changes the condition: reading the next mark.

4. The loop resets its own variables

Loses marks

Wrong: the return arrow goes back above total = 0, so the total is reset on every pass

Correct

Right: the return arrow goes back to the input, so each pass reads the next mark

Initialisation (total = 0) belongs before the loop. Returning above it sets the total back to zero on every pass.

Can you answer these five programming flowchart questions?

Answer each one, then open the worked answer.

Question 1. Which symbol holds print("Hello")?

Worked answer

The parallelogram: printing is output.

Question 2. Which symbol holds x = x * 2?

Worked answer

The process rectangle: it is an assignment.

Question 3. How can you tell a while loop from a repeat-until loop on a flowchart?

Worked answer

In a while loop the diamond comes before the body, so the body may run zero times. In a repeat-until loop the diamond comes after the body, so it runs at least once.

Question 4. Which symbol signifies control passing between stages of an algorithm?

Worked answer

The flow line, an arrow. Across pages or far parts of one page, a connector with matching letters does the same job.

Question 5. Trace the finished marks flowchart with the input -1 only. What is printed?

Worked answer

The loop ends at once with count = 0. The second decision, count > 0?, is No, so it prints No marks instead of dividing by zero.

Questions

What are the programming flowchart symbols?

Terminal, process rectangle, input/output parallelogram, decision diamond, flow line, preparation hexagon, loop limit, predefined process (subroutine), connector and annotation.

What are the algorithm symbols in a flowchart?

The same shapes: an oval for start and end, a rectangle for each instruction, a parallelogram for input and output, and a diamond for each condition, joined by arrows.

What are the flowchart symbols in computer science?

The ISO 5807 program flowchart symbols. Courses usually require the terminal, process, input/output, decision and flow line, and often the subroutine box.

What are coding flow chart shapes?

Shapes that map to code: rectangles to assignments, parallelograms to input and print, diamonds to if and while conditions, and double-sided rectangles to function calls.

Which flowchart symbol is used to signify control passing between stages of an algorithm?

The flow line, an arrow. A connector circle continues the flow elsewhere on the page.

How do you draw a for loop in a flowchart?

Either with a preparation hexagon that holds the loop header, such as i = 1 to 10, or with an initialisation box, a decision and an increment box joined back to the decision.

Sources

The rules and names on this page were checked against these documents.

Related references

Describe the process in plain English. ChartCraft picks the right symbol for every step.

Flowchart generator →