Mermaid Gantt charts
Turn a list of tasks and dates into a project schedule. This guide covers the Gantt chart syntax, with examples you can load into the converter and download as a PDF.
Download PDF opens your browser's print dialog. Choose Save as PDF as the destination.
Your first Gantt chart
A Gantt chart shows a project's tasks as bars along a calendar, so you can see at a glance what happens when, what overlaps and when the whole thing finishes. It's a staple of project plans, proposals and status reports. In Mermaid, you write the tasks as a list and Mermaid works out where each bar goes.
Start the block with gantt, then give it a dateFormat line saying how you'll
write dates. Group tasks under section lines; each section gets its own band of color and
its name down the left side.
```mermaid
gantt
title Garden makeover
dateFormat YYYY-MM-DD
section Prepare
Clear the beds :2026-03-02, 3d
Order the plants :2026-03-03, 2d
section Plant
Plant the shrubs :2026-03-09, 2d
Sow the lawn :2026-03-11, 1d
```
How a task line works
Each task is a name, a colon and up to four details separated by commas, in this order:
- Tags (optional):
done,active,critormilestone, explained below. - An ID (optional): a short name such as
t1, so other tasks can start after this one. - The start: a date, or
afterand another task's ID. - The end: a date, or a length such as
3d.
Lengths use d for days, w for weeks and h for hours, so
2w is two weeks. If a task gives only a length, with no start, it begins when the task
above it ends, which is the quickest way to write a plan where each step follows the last.
```mermaid
gantt
title Writing a report
dateFormat YYYY-MM-DD
section Draft
Research :2026-05-04, 1w
Outline :2d
First draft :1w
section Finish
Edit :3d
Design and layout :2026-05-25, 2026-05-29
```
The last task uses an end date instead of a length. Either works; pick whichever matches how you think about the task.
Tasks that depend on others
Give a task an ID and later tasks can start after it. When the first task moves, everything
after it moves too, so you only have to change one date to replan. A task waiting on several others can
list them all, as in after design copy, and starts when the last of them ends.
```mermaid
gantt
title Launching a website
dateFormat YYYY-MM-DD
section Content
Write the copy :copy, 2026-06-01, 8d
Take photos :photos, 2026-06-03, 4d
section Build
Design :design, 2026-06-01, 6d
Development :dev, after design, 10d
section Launch
Final review :review, after dev copy photos, 2d
Go live :milestone, after review, 0d
```
Done, active, critical and milestones
Tags at the start of a task change how its bar is drawn, which turns a plan into a progress report.
| Tag | Means | Drawn as |
|---|---|---|
done | Finished | A grey bar |
active | In progress | A lighter bar than the others |
crit | On the critical path: if it slips, the end date slips | A red bar, or a red outline if it's also active |
milestone | A moment rather than a task | A diamond |
Tags can be combined, as in crit, done. A milestone takes a length of 0d, and
Mermaid places the diamond at its start.
```mermaid
gantt
title Product release
dateFormat YYYY-MM-DD
section Build
Core features :done, core, 2026-09-07, 10d
Payments :crit, active, pay, after core, 8d
Help pages :help, after core, 5d
section Release
Beta :milestone, after pay, 0d
Fix beta feedback :crit, fixes, after pay, 5d
Release :milestone, after fixes, 0d
```
Weekends and holidays
By default every day counts, so a five-day task that starts on a Thursday ends on the Monday after.
Add excludes weekends and Mermaid skips Saturdays and Sundays, stretching tasks over them so
that 5d means five working days. You can also exclude particular dates, such as public
holidays, by listing them: excludes weekends, 2026-12-25, 2026-12-28.
```mermaid
gantt
title Year-end close
dateFormat YYYY-MM-DD
excludes weekends, 2026-12-25, 2026-12-28
section Finance
Reconcile accounts :rec, 2026-12-21, 5d
Prepare statements :after rec, 4d
```
Excluded days still appear on the chart, so the bars look longer than the number of days they count. That's intended: the chart shows real calendar time, while the lengths you type count working days.
Dates along the axis
dateFormat describes how you type dates. How they're shown along the
bottom of the chart is set separately, with axisFormat, which uses codes like
%d for the day, %b for a short month name and %Y for the year.
tickInterval sets the spacing between labels, such as 1week or
1month.
```mermaid
gantt
title Hiring plan
dateFormat YYYY-MM-DD
axisFormat %b %Y
tickInterval 1month
section Roles
Designer :2026-01-12, 6w
Engineer :2026-02-02, 10w
Marketer :2026-04-06, 8w
```
md2pdf.me labels the axis with short dates such as Nov 2 unless the chart has its own
axisFormat line. Mermaid also draws a line at today's date when today falls within the
chart, which marks how far a project has got, but in a PDF it records the day you saved it. Add
todayMarker off to leave it out.
Common mistakes
When a chart has a mistake, the preview shows its code with the error above it. A chart can also draw without an error and still look wrong. These are the usual causes:
- Dates that don't match
dateFormat. WithYYYY-MM-DD, a task dated3/9/2026doesn't cause an error: Mermaid guesses, and reads it as March 9 whether you meant that or 3 September. Write every date the same way, or change the format line to match, such asdateFormat DD/MM/YYYY. - A colon in a task name. The first colon separates the name from its details, so
Phase 2: testingis drawn as a task called Phase 2 with muddled dates. Use a dash instead. - Tags after the dates.
done,critand the other tags must come first, before the ID and dates. - An
afterpointing at a missing ID. IDs are case sensitive, soafter Designwon't find a task with the IDdesign. There's no error: the task is drawn starting today instead, which can stretch the whole chart.
Gantt charts in a PDF
md2pdf.me draws each chart as a vector graphic, so the bars and labels stay sharp however far you zoom into the PDF, and a chart is never split across two pages. Charts are drawn at the width of the page's text, and the more time they cover the narrower each day gets. A chart covering a few weeks shows every day clearly; one covering a year works better with monthly labels, as in the hiring plan above.
For a long project, a chart per phase, each with a heading and a sentence or two about it, is easier to read than a single chart with fifty rows. A short summary chart at the start, with one task per phase, gives readers the overall picture before the detail.
A chart's colors come from the style you choose. Classic, Academic and Résumé draw it in shades of grey for printing, Modern and Report in their blue accent, Worksheet in its own blue and purple, and GitHub in the same colors as github.com. The themed styles use their own colors: oxblood for Gothic, rust and navy for Sandwake, forest green for Elvish, teal and magenta for Cyberpunk, black and oxblood on newsprint grey for Newspaper, and ink and vermilion for Fiendish. Critical tasks are red in every style, so they stand out even on a grey chart.
Other diagram types
- Flowcharts: steps, decisions and the arrows between them
- Sequence diagrams: messages between people or systems over time
- Class diagrams: classes, fields and methods
- State diagrams: the states something moves through
- Entity relationship diagrams: database tables