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:
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 example2026-01-05. - Dependency:
after a1starts the task when taska1ends.after a1 b2waits for both. - Duration:
3dfor days,2wfor weeks,12hfor hours — or an end date instead. - Axis labels:
axisFormat %b %dprints 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:
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
| What | Syntax |
|---|---|
| Date format | dateFormat YYYY-MM-DD |
| Task with start date | Design :a1, 2026-01-05, 5d |
| Task after another | Build :b1, after a1, 10d |
| Finished / in progress / critical | :done, … :active, … :crit, … |
| Milestone | Launch :milestone, m1, after b1, 0d |
| Skip weekends | excludes weekends |
| Axis label format | axisFormat %b %d |
Tips
- Prefer
afterdependencies 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.
Lite is free for personal use; Pro is $9.99 one-time. Requires macOS 13.0 or later, Intel and Apple Silicon.