Unsaved
Ready
Loading Monaco Editor...
Preview
Styling
Gantt Chart
All diagram types

Mermaid Gantt Chart Syntax & Schedule Examples

A Gantt chart is a schedule: tasks have start dates and durations, and later tasks can wait on earlier ones.

Examples

Copy an example, or open it in the live editor with this diagram already loaded.

Release plan with dependencies

Later tasks use after so they start when the named task ends. Sections group the plan into phases.

gantt
    title March release
    dateFormat YYYY-MM-DD
    section Shape
    Write the spec        :spec, 2026-03-02, 4d
    Review the spec       :review, after spec, 2d
    section Build
    Implement the API     :api, after review, 5d
    Implement the UI      :ui, after review, 5d
    section Ship
    Release               :milestone, ship, after api, 0d

Content calendar

A compact calendar with fixed dates and day durations. No dependencies, because the dates are chosen up front.

gantt
    title April content
    dateFormat YYYY-MM-DD
    section Drafts
    Tutorial outline      :2026-04-01, 2d
    Editor screenshots    :2026-04-03, 2d
    section Publish
    Blog post             :2026-04-07, 1d
    Changelog             :2026-04-08, 1d

Milestone markers

Milestones use the milestone tag and a zero-day duration. They mark a date without drawing a long bar.

gantt
    title Beta checkpoints
    dateFormat YYYY-MM-DD
    section Beta
    Private beta          :2026-05-04, 10d
    API freeze            :milestone, 2026-05-15, 0d
    Public beta           :milestone, 2026-05-18, 0d

What is a Gantt Chart?

A Mermaid Gantt chart is a bar schedule. dateFormat tells Mermaid how to read dates. Each task line has a label, a short id, a start, and a duration. after someId starts a task when another one finishes, which is how you encode a dependency. section groups tasks into phases. A milestone is a task with the milestone tag and a duration of 0d. Use a Gantt chart for a project plan. Use a timeline when you only need labeled events and do not care about duration.

When to use it

Use a Gantt chart for releases, migrations, and research plans where dates and dependencies matter. Use a timeline for a history or a roadmap that is a sequence of labels. Use a Kanban board when the work has columns and no dates.

Edit this gantt chart in the live editor, read the Gantt chart tutorial, or compare it with Flowchart, Sequence Diagram and State Diagram.

Common Use Cases

  • •Project management - Plan and track project timelines
  • •Sprint planning - Visualize agile sprint schedules
  • •Resource allocation - See who's working on what and when
  • •Milestone tracking - Mark and monitor key project dates
  • •Dependency mapping - Understand task relationships and blockers

Syntax Quick Reference

ElementSyntaxDescription
Titletitle Project NameChart heading
Sectionsection NameGroup related tasks
TaskTask name :id, start, durationDefine a task
Dependencyafter taskIdTask depends on another
Duration7d, 2wDays (d) or weeks (w)
MilestoneMilestone :milestone, m1, 0dZero-duration marker

Syntax tips

  • •Set dateFormat before the tasks. YYYY-MM-DD matches the ISO dates in the examples on this page.
  • •Give a task an id when something else depends on it: Name :id, 2026-03-02, 4d. Then write after id on the next task.
  • •Durations are 4d for days or 2w for weeks. A milestone uses 0d.
  • •section Name starts a group. Tasks stay in that section until the next section line.
  • •excludes weekends drops Saturday and Sunday from the axis. Put it near the top, after dateFormat.

Common mistakes

Writing a date that does not match dateFormat.

If dateFormat is YYYY-MM-DD, every start date must look like 2026-03-02. A slash-formatted date will not parse.

Using after with a task that has no id.

The token after after is the task id, not the visible label. Add :spec (or another id) to the task you want to follow.

Using a Gantt chart to list events that have no duration.

If you only have labels such as Founded or Launched, a timeline is the clearer diagram. Keep Gantt for work that occupies time.

Export Options

Schedules are often printed or dropped into a status doc. PDF matches a status page; SVG matches a docs site. Free PNG exports include a watermark.

Got Mermaid code from ChatGPT? Paste it here to render and export instantly.

Get the Free Mermaid Syntax Cheat Sheet

Free Mermaid Syntax Cheat Sheet

All 21 diagram types in one PDF reference.

Frequently Asked Questions

Ready to create your own gantt chart?

Open the editor with this example pre-loaded and start customizing.

Gantt Chart templates

Related Diagram Types

All diagram types