Mermaid Gantt Chart

Project schedules as plain text in your Markdown files

A Mermaid Gantt chart turns a list of tasks with dates and durations into a schedule. Because it is plain text, the plan lives next to your code or docs, shows up in pull requests and is easy to change. It renders in GitHub, GitLab, Obsidian and MDViewer.

Basic Gantt Chart

Every Gantt chart starts with gantt and a dateFormat that tells Mermaid how to read your dates. Tasks sit under section headings:

Mermaid ```mermaid gantt title Website redesign dateFormat YYYY-MM-DD section Design Wireframes :a1, 2026-01-05, 5d Visual design :a2, after a1, 7d section Build Frontend :b1, after a2, 10d Launch :milestone, m1, after b1, 0d ```
Mermaid Gantt chart: design and build sections with a launch milestone

Each task line is Name :id, start, duration. The id is optional, but you need it to make other tasks depend on this one.

Dates, Durations and Dependencies

  • Start date: a date in your dateFormat, for example 2026-01-05.
  • Dependency: after a1 starts the task when task a1 ends. after a1 b2 waits for both.
  • Duration: 3d for days, 2w for weeks, 12h for hours — or an end date instead.
  • Axis labels: axisFormat %b %d prints dates like “Feb 02” (d3 time-format codes).

Task Status, Milestones and Weekends

Put a tag before the id to style a task: done, active or crit (critical, shown in red). A milestone with a duration of 0d becomes a diamond. excludes weekends skips Saturdays and Sundays when counting durations:

Mermaid ```mermaid gantt title Sprint 12 dateFormat YYYY-MM-DD axisFormat %b %d excludes weekends section Backend Spec :done, s1, 2026-02-02, 3d API :active, s2, after s1, 5d Security fix :crit, s3, after s1, 2d section Release Release :milestone, after s2, 0d ```
Mermaid Gantt chart with done, active and critical tasks, weekends excluded

Notice how the five-day API task stretches over the weekend: excluded days are shaded and do not count toward the duration.

Syntax Cheat Sheet

WhatSyntax
Date formatdateFormat YYYY-MM-DD
Task with start dateDesign :a1, 2026-01-05, 5d
Task after anotherBuild :b1, after a1, 10d
Finished / in progress / critical:done, … :active, … :crit, …
MilestoneLaunch :milestone, m1, after b1, 0d
Skip weekendsexcludes weekends
Axis label formataxisFormat %b %d

Tips

  • Prefer after dependencies over fixed dates: move one task and everything after it shifts.
  • Long charts get wide. Split a big plan into one chart per phase.
  • For a simple list of dates without durations, a Mermaid timeline is easier to read.

More Mermaid guides: What is Mermaid, flowcharts, sequence diagrams, timelines, Gantt charts, class diagrams, ER diagrams and pie charts. To open .mmd files on a Mac, see how to open Mermaid files.

FAQ

How do I create a Gantt chart in Markdown?

Use a fenced code block with the language mermaid. Start with gantt, set dateFormat YYYY-MM-DD, add section headings and one line per task: Task :id, 2026-01-05, 5d.

How do I add a milestone in a Mermaid Gantt chart?

Add the milestone tag and a zero duration: Launch :milestone, m1, after b1, 0d. It is drawn as a diamond.

How do I exclude weekends in a Mermaid Gantt chart?

Add the line excludes weekends after dateFormat. Durations then count only working days. You can also exclude specific dates, for example excludes 2026-12-25.

Does GitHub support Mermaid Gantt charts?

Yes. GitHub renders Mermaid code blocks, including gantt, in Markdown files, issues and pull requests.

View It with MDViewer

MDViewer renders Mermaid diagrams inside any .md file on your Mac — click a diagram to zoom and pan. Paste an example from this guide into a file and open it, or try it without installing in the free online viewer.

Download MDViewer

Lite is free for personal use; Pro is $9.99 one-time. Requires macOS 13.0 or later, Intel and Apple Silicon.