---
title: "Mermaid Gantt chart syntax, with templates to open"
description: "A Mermaid Gantt chart is a list of tasks, one per line: a name, a colon, then the start and the length. Dependencies, weekends, holidays and milestones each take one keyword. Every example below renders as written in Mermaid 12.3 and 11.17, including four mistakes that draw a wrong chart without any error."
date: 2026-11-29
lang: en
canonical: https://goingstellar.ro/methods/mermaid-gantt-chart-syntax-examples/
author: Going Stellar
publisher: GOING STELLAR S.R.L.
topic: Mermaid / Diagrams
license: CC BY 4.0
alternate_ro: https://goingstellar.ro/ro/metode/diagrama-gantt-mermaid-sintaxa-exemple/
---

# Mermaid Gantt chart syntax, with templates to open

*A Mermaid Gantt chart is a list of tasks, one per line: a name, a colon, then the start and the length. Dependencies, weekends, holidays and milestones each take one keyword. Every example below renders as written in Mermaid 12.3 and 11.17, including four mistakes that draw a wrong chart without any error.*

> Mermaid · Diagrams · 2026-11-29 · https://goingstellar.ro/methods/mermaid-gantt-chart-syntax-examples/

## Key points

- A task line is a name, a colon, then an id, a start and an end or a length; tags such as `done` or `crit` go first.
- `after a b` starts when the last of a and b ends; `until x` runs until x starts.
- `excludes weekends` plus your holiday dates keeps the working days and moves the end date; Mermaid knows no holidays.
- A wrong date format, a mistyped id, a repeated id or a colon in a name all draw a wrong chart with no error.

## The smallest useful Gantt chart

Start with `gantt`, set the date format, then write one task per line. `section` lines group the tasks under a heading.

```mermaid
gantt
    title Website launch
    dateFormat YYYY-MM-DD
    section Design
    Wireframes      :w1, 2026-12-01, 3d
    Visual design   :w2, after w1, 4d
    section Build
    Front end       :b1, after w2, 5d
    Content         :2026-12-03, 6d
```

Each task line is the task name, a colon, and then up to three items separated by commas: an id, a start and an end or a length. `after w1` starts a task when the task with id `w1` ends. A task with no start begins where the previous task ends, so a plain list of tasks is drawn in sequence. `dateFormat` is how you type dates; the default is `YYYY-MM-DD`.

## Status tags: done, active, crit

Before the id, a task can carry tags. `done` and `active` change the bar's colour, `crit` marks it as critical, and `milestone` turns it into a single point in time. Tags can be combined.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Spec signed off  :done, s1, 2026-12-01, 2d
    API              :active, a1, after s1, 4d
    Payment provider :crit, p1, after s1, 6d
    Load test        :crit, active, after a1, 2d
```

Tags must come first. With the id before the tag, the chart fails with an error that does not name the line: `Cannot read properties of undefined (reading 'type')`.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Review :r1, done, 2026-12-01, 3d
```

Move the tag to the front and it renders:

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Review :done, r1, 2026-12-01, 3d
```

## Dependencies: after and until

`after` accepts several ids and starts the task when the last of them ends. `until` makes a task run until another task or milestone starts; it needs Mermaid 10.9 or newer.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Back end        :be, 2026-12-01, 4d
    Mobile app      :mob, 2026-12-01, 6d
    Integration     :int, after be mob, 2d
    Bug bash        :2026-12-01, until rel
    Release         :milestone, rel, 2026-12-10, 0d
```

Here Integration starts when Mobile app ends, two days after Back end, and the bug bash stretches to the release milestone. Change the release date and the bug bash follows it.

## Lengths

A length is a number and a unit: `ms`, `s`, `m`, `h`, `d`, `w`, `M` (months) or `y`. `1w` is seven days and `1M` is a calendar month. Decimals such as `1.5d` work. Mermaid ignores a length it cannot read, such as `3dX`, and draws the task with no length at all.

## Skipping weekends and public holidays

`excludes` takes `weekends`, weekday names such as `sunday`, and dates in the `dateFormat`. Several `excludes` lines add up, and dates can be separated by spaces or commas.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    excludes weekends
    excludes 2026-12-25, 2026-12-28
    %% 3 working days from Thursday 24 December
    Year-end report :2026-12-24, 3d
```

This task is three working days long and starts on Thursday 24 December. With the 25th, the weekend and the 28th excluded, its bar runs to the end of Wednesday the 30th: Mermaid keeps the working days you asked for and pushes the end to the right. When the excluded days fall between two tasks instead, the next task starts after them and the gap stays empty.

Mermaid does not know any public holidays, so list them yourself. The word `weekdays` is not accepted: the line is ignored without an error, and nothing is excluded.

Since Mermaid 11, `weekend friday` makes the weekend Friday and Saturday. The default is Saturday and Sunday.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    excludes weekends
    weekend friday
    Site survey :2026-12-03, 2d
```

## Milestones, deadline lines and the today line

A `milestone` is drawn as a diamond. With a length, it sits halfway through it: `2026-12-03, 2d` places it on the 4th. A `vert` task draws a vertical line across the whole chart and takes no row, which suits a code freeze or a deadline. The line for today appears by default; `todayMarker off` removes it, which keeps exported images from going out of date.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    todayMarker off
    Sprint work   :s1, 2026-12-07, 10d
    Code freeze   :vert, cf, 2026-12-14, 0d
    Sprint review :milestone, m1, 2026-12-17, 0d
```

## Dates on the axis

`dateFormat` is the format you type; `axisFormat` is what the axis shows, written with d3 codes: `%d %b` gives “07 Dec”, `%b` the month alone. `tickInterval` sets the spacing of the axis ticks (`1day`, `1week`, `1month`), and `weekday monday` starts weekly ticks on Monday instead of Sunday.

```mermaid
gantt
    dateFormat DD-MM-YYYY
    axisFormat %d %b
    tickInterval 1week
    weekday monday
    Discovery :d1, 07-12-2026, 2w
    Build     :b1, after d1, 3w
```

## Compact mode for rotas

By default every task gets its own row. `displayMode: compact` in the front matter puts tasks that do not overlap on the same row, which suits an on-call rota or a room booking chart.

```mermaid
---
displayMode: compact
---
gantt
    dateFormat YYYY-MM-DD
    section On call
    Ana   :a, 2026-12-01, 7d
    Ben   :b, after a, 7d
    Chris :c, after b, 7d
```

## Mistakes that draw a wrong chart without an error

These four render without any error message, so they are easy to miss:

**A date in the wrong format.** With `dateFormat YYYY-MM-DD`, a start typed as `01-12-2026` is read as a date far from the others. The axis stretches to cover both, and every bar shrinks to a sliver.

**A typo after `after`.** `after nope`, where no task has the id `nope`, starts the task today.

**The same id twice.** `after a` follows the last task that uses the id `a`.

**A colon in a task name.** The first colon ends the name, so `Fix: login` shows as “Fix” and the rest of the line is read as the task's details.

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Fix: login :a, 2026-12-01, 1d
```

Write the colon as `#58;` and the name renders in full:

```mermaid
gantt
    dateFormat YYYY-MM-DD
    Fix#58; login :a, 2026-12-01, 1d
```

When a chart looks wrong but shows no error, check these first.

## Gantt chart or timeline?

A Gantt chart needs dates and lengths. When you only have periods and events, such as quarters or version numbers, a `timeline` diagram is simpler: one period per line, then its events after colons.

```mermaid
timeline
    title Release history
    section 2026
      2.0 : New editor : Dark theme
      2.1 : Export to PNG
    section 2027
      3.0 : Public API
```

## Seven templates to start from

Each link opens our free online Mermaid editor with the template already drawn. Change the text, then copy or download the result as SVG or PNG.

Two-week sprint plan: planning, build, test and review, weekends skipped.Quarterly product roadmap: one section per quarter.Release plan with dependencies: code freeze, release candidate, go/no-go, rollout.Project plan that skips holidays: weekends and three public holidays excluded.Jira epics timeline: epics as sections, their work items as tasks.Roadmap timeline by quarter and release history, drawn as `timeline` diagrams.

The editor runs in the browser and the diagram text is not uploaded. The Jira epics template is typed by hand: Mermaid does not read data from Jira.

## Gantt charts in Confluence and Jira

Confluence Cloud does not render Mermaid on its own. For a timeline it offers two macros: the Roadmap planner, where you draw bars, lanes and markers by hand on a page (it does not work in live docs yet), and the Jira timeline macro, which shows the timeline of a team-managed Jira space and updates in real time. The Jira timeline shows work items from one space; planning across spaces is part of plans, which come with Jira Premium and Enterprise.

A Mermaid Gantt chart fits when the plan lives in text: a migration plan, a release checklist, a page people edit in review. Mermaid Studio for Confluence, our app, renders it on the page from that text, so a new date is a one-line edit. It uses Mermaid 11.17, and every example on this page renders the same there.

One difference from the Mermaid documentation: `click` lines that open a link do nothing in our editor or in Mermaid Studio. Both run Mermaid with `securityLevel` set to strict, which turns click handling off.

## Limits

Every example was rendered with Mermaid 12.3.0, the version in our editor, and with 11.17.2, the version in Mermaid Studio, on 29 November 2026. A Mermaid Gantt chart is a drawing of the dates you type: it has no field for who does a task or how far along it is, and it does not move dates when work slips. If the plan needs those, keep it in Jira and show the Jira timeline.

## Sources

1. [Mermaid documentation: Gantt diagrams](https://mermaid.js.org/syntax/gantt.html)
2. [Mermaid documentation: Timeline diagrams](https://mermaid.js.org/syntax/timeline.html)
3. [Mermaid documentation: Configuration (securityLevel)](https://mermaid.js.org/config/schema-docs/config.html)
4. [Atlassian Support: Insert the roadmap planner macro (Confluence Cloud)](https://support.atlassian.com/confluence-cloud/docs/insert-the-roadmap-planner-macro/)
5. [Atlassian Support: Insert the Jira timeline macro (Confluence Cloud)](https://support.atlassian.com/confluence-cloud/docs/insert-the-jira-timeline-macro/)
6. [Atlassian Support: Timeline limits in Jira](https://support.atlassian.com/jira-software-cloud/docs/set-up-the-roadmap/)
7. [Atlassian Support: What are macros? (macros available in the Confluence Cloud editor; no Mermaid macro, read 29-nov)](https://support.atlassian.com/confluence-cloud/docs/what-are-macros/)
8. [Atlassian Marketplace: Mermaid Studio for Confluence](https://marketplace.atlassian.com/apps/1011179388/mermaid-studio-ai-mermaid-diagram-editor)

## Questions and answers

### How do I skip weekends in a Mermaid Gantt chart?

Add `excludes weekends`. A task keeps the number of working days you gave it and its end moves to the right. Add holiday dates to `excludes` as well; Mermaid does not know them.

### How do I make one task start after another in Mermaid?

Give the first task an id and start the second with `after` and that id: `Build :b1, after d1, 5d`. With several ids, it starts when the last of them ends.

### How do I add a milestone to a Mermaid Gantt chart?

Use the `milestone` tag with a length of `0d`: `Release :milestone, m1, 2026-12-10, 0d`.

### Can I show a Mermaid Gantt chart in Confluence?

Not with Confluence alone: it does not render Mermaid. Export the chart as an image, or use an app that renders Mermaid on the page, such as Mermaid Studio for Confluence.

## How to cite

**Cite this as:** Going Stellar (2026). *Mermaid Gantt chart syntax, with templates to open*. GOING STELLAR S.R.L.. https://goingstellar.ro/methods/mermaid-gantt-chart-syntax-examples/

```bibtex
@misc{goingstellar2026mermaid,
  title  = {Mermaid Gantt chart syntax, with templates to open},
  author = {{Going Stellar}},
  year   = {2026},
  url    = {https://goingstellar.ro/methods/mermaid-gantt-chart-syntax-examples/},
  note   = {2026-11-29}
}
```

Licence. Free to quote with attribution.

## Also available

- This page as HTML: https://goingstellar.ro/methods/mermaid-gantt-chart-syntax-examples/
- Same article in Romanian: https://goingstellar.ro/ro/metode/diagrama-gantt-mermaid-sintaxa-exemple/
