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.

Markdown
Preview

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:

  1. Tags (optional): done, active, crit or milestone, explained below.
  2. An ID (optional): a short name such as t1, so other tasks can start after this one.
  3. The start: a date, or after and another task's ID.
  4. 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.

TagMeansDrawn as
doneFinishedA grey bar
activeIn progressA lighter bar than the others
critOn the critical path: if it slips, the end date slipsA red bar, or a red outline if it's also active
milestoneA moment rather than a taskA 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:

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

Back to the Mermaid cheat sheet