Every software project lives and dies by its timeline. Whether you are coordinating a two-week sprint or a six-month product launch, you need a way to visualize what is happening, when, and what depends on what. That is exactly what Gantt charts do -- and with Mermaid.js, you can create them as fast as you can type.
A Brief History of Gantt Charts
The Gantt chart is named after Henry Gantt, an American mechanical engineer who popularized the format around 1910-1915. Gantt developed his bar charts to visualize production schedules in factories, giving managers a clear picture of which tasks were on track and which were falling behind. The format was so effective that it was used to plan the construction of the Hoover Dam and coordinate Allied logistics during World War I.
Over a century later, the core concept remains unchanged: horizontal bars on a timeline, with each bar representing a task's start date and duration. What has changed is the medium. Instead of hand-drawn charts on paper, we can now define Gantt charts as code that renders automatically, lives in version control, and updates with a text edit.
Anatomy of a Gantt Chart
Every Gantt chart is built from a few fundamental components:
- Tasks: The individual work items, represented as horizontal bars. Each task has a start date (or a dependency that determines when it starts) and a duration or end date.
- Sections: Logical groupings of related tasks. In software projects, sections often correspond to workstreams, teams, or project phases.
- Dependencies: Relationships between tasks that control sequencing. Task B cannot start until Task A is complete. Dependencies are what make Gantt charts more than just a list of dates.
- Milestones: Zero-duration markers that represent key decision points or deliverables. "Feature freeze," "Beta release," and "Go live" are classic milestones.
- Timeline: The horizontal axis showing dates. The chart automatically scales to fit the project's timeframe.
Mermaid Gantt Syntax Deep Dive
Let us start with a simple chart and then layer on features.
Basic Structure
gantt
title My Project Timeline
dateFormat YYYY-MM-DD
section Planning
Requirements gathering :a1, 2026-04-01, 5d
Technical design :a2, after a1, 3d
Design review :milestone, m1, after a2, 0d
section Development
Backend API :b1, after a2, 10d
Frontend UI :b2, after a2, 12d
Integration :b3, after b1, 5d
section Testing
QA testing :c1, after b3, 7d
Bug fixes :c2, after c1, 5d
Release :milestone, m2, after c2, 0dLet us break down the syntax line by line:
gantt-- Declares the diagram type.title-- Sets the chart title displayed at the top.dateFormat YYYY-MM-DD-- Tells Mermaid how to parse your dates. Other options includeDD-MM-YYYY,MM-DD-YYYY, and more.section Planning-- Creates a labeled section that groups the tasks below it.:a1, 2026-04-01, 5d-- Assigns IDa1, starts on April 1, and lasts 5 days.:a2, after a1, 3d-- Starts immediately after taska1completes, lasts 3 days.:milestone, m1, after a2, 0d-- A milestone (zero duration) placed after taska2.
Task States
Mermaid supports task states that visually distinguish tasks by their progress:
gantt
title Task States Demo
dateFormat YYYY-MM-DD
section Sprint 1
Completed task :done, t1, 2026-04-01, 5d
Active task :active, t2, after t1, 3d
Future task :t3, after t2, 4d
Critical task :crit, t4, after t3, 2d
Critical + active :crit, active, t5, after t4, 3ddone-- Renders with a muted/completed style.active-- Highlights the task as currently in progress.crit-- Marks the task as critical path, rendered in red.- You can combine states:
crit, activemarks a task as both critical and active.
Excludes
Real projects do not work on weekends or holidays. Mermaid's excludes keyword lets you skip specific days:
gantt
title Sprint with Weekends Off
dateFormat YYYY-MM-DD
excludes weekends
section Sprint
Story 1 :s1, 2026-04-06, 3d
Story 2 :s2, after s1, 2d
Story 3 :s3, after s2, 4dYou can also exclude specific dates for holidays: excludes weekends, 2026-04-10. When weekends are excluded, a "5d" task scheduled on a Monday will end on Friday, not Wednesday -- the chart skips Saturday and Sunday automatically.
Real Project Planning Example
Here is a realistic Gantt chart for an API migration project, the kind of chart you might attach to a project proposal or share in a planning meeting:
gantt
title API v2 Migration
dateFormat YYYY-MM-DD
excludes weekends
section Discovery
Audit existing endpoints :done, d1, 2026-04-01, 5d
Document breaking changes :done, d2, after d1, 3d
Stakeholder review :done, milestone, m1, after d2, 0d
section Build
Auth module rewrite :active, b1, 2026-04-14, 8d
New serialization layer :b2, 2026-04-14, 6d
Rate limiting middleware :b3, after b2, 4d
Versioned routing :b4, after b1, 3d
Build complete :milestone, m2, after b4, 0d
section Migrate
Internal consumers :mi1, after m2, 5d
Partner integrations :mi2, after mi1, 10d
Legacy deprecation notice :mi3, after mi1, 2d
section Launch
Canary deployment :crit, l1, after mi2, 3d
Full rollout :crit, l2, after l1, 2d
v1 sunset :milestone, m3, after l2, 0dThis single chart communicates the entire project plan: phases, parallelism, dependencies, critical path, and key milestones. A project manager can see that the Auth module rewrite and the serialization layer run in parallel. A stakeholder can see that the earliest possible launch date depends on partner integration testing. An engineer can see exactly which tasks they are blocked by.
Tips for Keeping Gantt Charts Useful
1. Keep Them High-Level
A Gantt chart with 200 tasks is not useful -- it is a wall of bars. Aim for 15 to 30 tasks that represent meaningful work packages. If you need more detail, break the project into sub-charts per workstream.
2. Update Them Regularly
A Gantt chart is a living document. When task durations change or dependencies shift, update the chart. Because Mermaid charts are text, updates take seconds -- change a number, and the entire chart reflows.
3. Use Milestones as Communication Tools
Milestones are not just markers -- they are promises. Use them to mark points where you will communicate progress to stakeholders: "By this milestone, we will have a working demo." "By this milestone, the API contract is frozen."
4. Mark the Critical Path
The critical path is the longest sequence of dependent tasks. Any delay on the critical path delays the entire project. Mark these tasks with crit so the team knows where to focus.
5. Store Them With Your Code
Keep your Gantt chart in your project's repository, perhaps in a docs/ folder or the project README. When the chart lives with the code, it gets updated in the same pull requests that change the project scope. For more on this approach, see our guide on using diagrams for documentation.
Pro Tip: Mermaid Gantt charts render beautifully in GitHub Markdown. Add a ```mermaid code block to your project's README or wiki, and GitHub will render the chart inline. Every time you push an update to the chart, the rendered version updates automatically.
Beyond Software: Other Use Cases
While this article focuses on software project management, Gantt charts are equally valuable for:
- Event planning: Coordinate venue booking, speaker confirmations, marketing campaigns, and logistics.
- Product launches: Align engineering, marketing, sales enablement, and support training timelines.
- Onboarding plans: Map out a new hire's first 30, 60, and 90 days with clear milestones.
- Content calendars: Plan blog posts, social media campaigns, and release announcements on a shared timeline.
The format is universal. If your work involves coordinating tasks across time, a Gantt chart will help you see the big picture. And with Mermaid in SimpleMermaid, creating one takes minutes, not hours.
Plan Your Next Project
Paste any Gantt example above into SimpleMermaid and customize it for your timeline. Free and instant.
Open the Editor
Buy Me A Coffee