All posts
MermaidActivity DiagramsFlowchartProcess ComparisonUML Diagrams

Mermaid activity diagram vs flowchart: which diagram type should you use?

6 min readThe MermaidCreator team

At first glance, activity diagrams and flowcharts look almost identical—both show steps connected by arrows. But they model different things, and picking the right one changes whether your diagram clarifies or confuses your audience. Activity diagrams emphasize the action and state of a process; flowcharts emphasize decisions and branches. In Mermaid, flowcharts are more commonly used, but understanding both helps you choose wisely.

The core difference: actions vs. decisions

A flowchart is fundamentally about control flow—where decisions route you next. It answers: "If condition A, do X; if condition B, do Y."

An activity diagram is about concurrent activities and states. It answers: "Who does what, in what order, and where can things happen in parallel?"

This distinction ripples through syntax, structure, and use cases.

Flowchart basics

Flowcharts use rectangles for steps, diamonds for decisions, and arrows for flow:

flowchart TD
    A["User logs in"] --> B{"Username correct?"}
    B -->|Yes| C{"Password correct?"}
    B -->|No| D["Show error"]
    C -->|Yes| E["Grant access"]
    C -->|No| D
    D --> A
    E --> F["Redirect to home"]

Flowchart strengths:

  • Easy to read: most people understand rectangles and arrows
  • Decision-heavy: diamonds make logic branches crystal clear
  • Simple to draw: minimal syntax
  • Great for: algorithms, bug decision trees, troubleshooting guides

Activity diagram basics

Activity diagrams are UML-based and emphasize flow of control and synchronization. In Mermaid, an activity diagram uses the stateDiagram syntax but focuses on activities and decisions within a single process:

stateDiagram-v2
    [*] --> Order["📋 Take order"]
    Order --> Payment["💳 Process payment"]
    Payment --> Confirm{"Payment OK?"}
    Confirm -->|Yes| Pack["📦 Pack items"]
    Confirm -->|No| Refund["💰 Refund customer"]
    Refund --> [*]
    Pack --> Ship["🚚 Ship order"]
    Ship --> [*]

Activity diagram strengths:

  • State-focused: each node represents an activity or state, not just a step
  • Swimlane-friendly: can represent who does what (though Mermaid flowcharts do this too)
  • Synchronization: can model forking and joining (parallel work converging)
  • UML standard: aligns with formal process modeling

Side-by-side: same workflow, two diagrams

Here's an approval workflow in both formats.

As a flowchart:

flowchart TD
    A["Request submitted"] --> B{"Manager available?"}
    B -->|No| C["Queue request"]
    C --> D["Wait for manager"]
    D --> B
    B -->|Yes| E{"Approve?"}
    E -->|Yes| F["Grant access"]
    E -->|No| G["Deny & notify"]
    F --> H["Send confirmation"]
    G --> H
    H --> I["Request closed"]

As an activity diagram:

stateDiagram-v2
    [*] --> RequestSubmitted
    RequestSubmitted --> ManagerCheck
    
    ManagerCheck --> ManagerUnavailable: Not available
    ManagerUnavailable --> QueueRequest
    QueueRequest --> WaitForManager
    WaitForManager --> ManagerCheck
    
    ManagerCheck --> ApprovalDecision: Available
    
    ApprovalDecision --> GrantAccess: Approved
    ApprovalDecision --> DenyAccess: Denied
    
    GrantAccess --> SendConfirmation
    DenyAccess --> SendConfirmation
    
    SendConfirmation --> [*]

Both work, but they feel different:

  • Flowchart emphasizes decisions (diamonds) and branches
  • Activity diagram emphasizes states (activities) and transitions

When to use flowcharts

Use a flowchart when:

  1. Decision logic is the star — your process is primarily "if this, then that"
    • Example: troubleshooting guide, eligibility checker, algorithm walkthrough
  2. The audience prefers simplicity — flowcharts are familiar to non-technical users
  3. You want to highlight choices — diamonds make decisions pop visually
  4. Sequential flow is the main story — steps follow one path, with occasional branches

Flowchart example: bug triage

flowchart TD
    A["Bug reported"] --> B{"Reproducible?"}
    B -->|No| C["Ask for more info"]
    C --> A
    B -->|Yes| D{"Already known?"}
    D -->|Yes| E["Link to existing issue"]
    D -->|No| F{"Critical?"}
    F -->|Yes| G["Priority: P0"]
    F -->|No| H["Priority: P1"]
    G --> I["Assign to engineer"]
    H --> I
    E --> I
    I --> J["In triage backlog"]

This is classic flowchart territory—all about routing decisions.

When to use activity diagrams

Use an activity diagram when:

  1. Swimlanes and parallel work matter — you want to show who does what and when things happen simultaneously
    • Example: cross-functional workflow, multi-system orchestration
  2. State transitions are explicit — your process cares about what state the work is in, not just the next step
  3. Synchronization points exist — parallel activities need to converge before the next step
  4. UML alignment helps — your team uses UML; a standard diagram is better than ad-hoc

Activity diagram example: order fulfillment (with swimlanes)

flowchart TD
    subgraph Customer["🛒 Customer"]
        A["Place order"]
        B["Pay"]
        C["Receive"]
    end
    
    subgraph Warehouse["📦 Warehouse"]
        D["Pick items"]
        E["Pack box"]
        F["Ship"]
    end
    
    subgraph Finance["💰 Finance"]
        G["Process payment"]
        H["Update ledger"]
    end
    
    A --> B
    B --> G
    G --> D
    G --> H
    D --> E
    E --> F
    F --> C

(Note: Mermaid handles swimlanes better in flowcharts than activity diagrams, so the choice between the two here leans toward flowchart.)

Feature comparison table

FeatureFlowchartActivity Diagram
Decision branches⭐⭐⭐ Excellent⭐⭐ OK
Sequential steps⭐⭐⭐ Excellent⭐⭐⭐ Excellent
Parallel work / forking⭐⭐ Limited⭐⭐⭐ Designed for it
Swimlanes⭐⭐⭐ Good (subgraphs)⭐⭐ Supported but clunky
Start/end states⭐⭐ Rounded nodes⭐⭐⭐ [*] notation is clear
Readability (non-technical)⭐⭐⭐ Familiar⭐⭐ More formal/UML-heavy
Synchronization points⭐⭐ Implicit⭐⭐⭐ Explicit

The pragmatic choice in Mermaid

In practice, Mermaid's flowchart implementation is simpler and more powerful than its activity diagram support. Most teams use flowcharts unless they need swimlanes or explicit state modeling.

Choose flowchart if:

  • You want the simplest, most readable diagram
  • Your process has clear decisions
  • You're documenting for a general audience

Choose activity diagram if:

  • You need explicit swimlanes for multiple actors
  • State transitions are semantically important
  • You want UML compliance for formal documentation

Examples: which type wins?

ScenarioWinnerWhy
API request/response flowFlowchartEasy to show branches and error paths
Multi-team approval workflowActivity DiagramSwimlanes show who does what; states clarify "pending" vs. "approved"
Troubleshooting guideFlowchartDecisions are the core; simple to scan
State machine (e.g., order status)Activity DiagramState transitions are explicit; aligns with UML
CI/CD pipeline with parallel jobsActivity Diagram (or Gantt)Multiple stages run concurrently; sync points matter
Algorithm walkthroughFlowchartConditions and branches are the story

Mixing both in documentation

You don't have to choose one. Use:

  • A flowchart to explain the happy path and key decisions
  • An activity diagram to show swimlanes and parallel work
  • A sequence diagram to show multi-system interactions

For example, a hiring process might include:

  1. Flowchart: screening decisions
  2. Activity diagram: HR, hiring manager, and candidate lanes
  3. Sequence diagram: job offer email exchange

FAQ

Can I convert a flowchart to an activity diagram?
Yes, but flowcharts are easier to read for most use cases. Convert if you need swimlanes, state emphasis, or UML compliance.

Should I use activity diagrams for swimlanes?
No—use flowcharts with subgraphs. Mermaid's flowchart implementation has better swimlane support than its activity diagram syntax.

What if I want parallel execution in a flowchart?
Use fork and join nodes (if supported) or create a sequence diagram to show interactions between parallel systems. For swimlanes, use subgraphs.

Are flowcharts enough for my documentation?
Yes, 95% of the time. Only switch to activity diagrams if you need swimlanes (then use flowchart subgraphs) or formal UML alignment.

Start with a flowchart. If you hit a use case that needs swimlanes or state emphasis, try an activity diagram in the MermaidCreator editor. The right diagram type is the one your team understands fastest.

Related posts