# How to Create a Gantt Chart (Step by Step)

If you want to know how to create a Gantt chart, the core idea is simple: every task becomes one horizontal bar that starts at its start date and ends at its end date. You need three things before you draw anything, a task list, a start date for each task, and either an end date or a duration you can add to the start. Once those exist, the chart is just a set of bars on a date axis.

## Quick Answer

- Build a table with one row per task and columns for task name, start date, and duration or end date.
- Convert durations to end dates with $end = start + duration$ so every bar has a left edge and a width.
- Set the chart's x-axis to run from the earliest start date to the latest end date.
- Draw one horizontal bar per task, positioned at the start date and sized to the duration.
- Sort tasks by start date so the bars read top to bottom in the order work happens.

## Before You Start

You need a task list that is complete enough to be useful. Each row should describe one piece of work, not a phase that contains other work. If a task has subtasks, list the subtasks separately and let the parent be a summary row or leave it out.

You also need dates in a real date format, not text that looks like a date. Spreadsheet tools and plotting libraries both fail quietly when a column holds strings. In Excel, a date typed as text sits on the left of the cell by default, while a true date sits on the right. In Python, parse strings with a date function before you plot them.

Decide how you will express task length. Two options work well. You can store an end date directly, or you can store a duration in days and compute the end date. Durations are easier to maintain because changing a start date automatically moves the end. End dates are easier when the finish is fixed by a deadline.

Finally, pick your tool. A spreadsheet is fine for a handful of tasks. A plotting library is better when you want to regenerate the chart from data every time the plan changes.

## Step by Step

1. **Collect the task rows.** Write down each task with its start date and its duration in days. Keep the task names short so the axis labels stay readable.

2. **Compute each end date.** Add the duration to the start date. If a task starts on 2024-03-04 and lasts 5 days, it ends on 2024-03-09. Treat the duration as the number of days the bar spans.

3. **Find the project window.** The project start is the minimum of all start dates. The project end is the maximum of all end dates. The total duration is the difference between them in days.

4. **Sort the tasks.** Order rows by start date, earliest first. This makes the chart read like a schedule instead of a random list.

5. **Set up the axes.** Put task names on the vertical axis and dates on the horizontal axis. Invert the vertical axis so the first task appears at the top.

6. **Draw one bar per task.** Each bar's left edge is the start date and its width is the duration. Use a single color unless you need to distinguish categories.

7. **Add labels and a title.** Label the date axis, give the chart a title that names the project, and keep gridlines light so the bars stand out.

8. **Check the bars against the table.** Confirm that no bar starts before the project start or ends after the project end, and that overlapping tasks actually overlap on the chart.

## Worked Example

The dataset is a five-task project sheet with start dates and durations.

| Task | Start | Duration_days |
|---|---|---|
| Requirements | 2024-03-04 | 5 |
| Design | 2024-03-11 | 7 |
| Development | 2024-03-20 | 12 |
| Testing | 2024-04-05 | 6 |
| Deployment | 2024-04-15 | 3 |

End dates, computed by adding each duration to its start:

- Requirements end date: 2024-03-04 + 5 days = 2024-03-09
- Design end date: 2024-03-11 + 7 days = 2024-03-18
- Development end date: 2024-03-20 + 12 days = 2024-04-01
- Testing end date: 2024-04-05 + 6 days = 2024-04-11
- Deployment end date: 2024-04-15 + 3 days = 2024-04-18

Project window:

- Project start: min(start dates) = 2024-03-04
- Project end: max(end dates) = 2024-04-18
- Total project duration: (2024-04-18 - 2024-03-04).days = 45 days

So the chart covers 5 tasks across 45 days, from 2024-03-04 to 2024-04-18. Notice that Design starts two days after Requirements ends, Development starts two days after Design ends, and Testing starts four days after Development ends. Deployment starts four days after Testing ends. Those gaps are visible on the chart as white space between bars, which is exactly what a Gantt chart is good at showing.

Here is the Python code that produces the chart.

```python
import datetime as dt
import matplotlib.pyplot as plt
tasks = [('Requirements','2024-03-04',5),('Design','2024-03-11',7),
         ('Development','2024-03-20',12),('Testing','2024-04-05',6),
         ('Deployment','2024-04-15',3)]
fig, ax = plt.subplots(figsize=(16,9))
for i,(n,s,d) in enumerate(tasks):
    st = dt.datetime.strptime(s,'%Y-%m-%d')
    ax.barh(i, d, left=st, color='#1d4ed8')
ax.set_yticks(range(len(tasks)))
ax.set_yticklabels([t[0] for t in tasks])
ax.invert_yaxis()
plt.tight_layout(); plt.savefig('figure.png', dpi=100)
```

Output: a Gantt chart with 5 tasks spanning 45 days (2024-03-04 to 2024-04-18). The bars start at each task's start date and span its duration, and the y-axis is inverted so Requirements sits at the top.

If you would rather build the same chart in a spreadsheet, the mechanics are the same but the tool is different. The steps for that route are covered in [how to make a Gantt chart in Excel](/blog/data-analysis/how-to-make-gantt-chart-excel).

## Other Ways to Do It

**Spreadsheet stacked bar.** In Excel or Google Sheets, add a helper column that holds the number of days between the project start and each task's start. Plot a stacked horizontal bar chart with that helper column as the first series and the duration as the second. Format the first series to have no fill so only the duration bars show. Set the axis minimum to the project start date and the maximum to the project end date.

**Project management software.** Dedicated tools draw the chart for you and add dependencies, milestones, and resource assignments. They are worth it when the plan changes often, but they hide the arithmetic, which is why building one by hand once is useful.

**Charting libraries.** Any library that can draw a horizontal bar with a left offset can draw a Gantt chart. The pattern is always the same: position equals start, width equals duration.

## Troubleshooting

**Bars are all the same length.** Your duration column is probably being read as text, or every value is 1. Check the data type of the column before plotting.

**Bars start at the wrong place.** The left offset is usually measured from the axis minimum, not from zero. If your axis starts at the project start date, the offset for each task is the number of days from the project start to that task's start.

**The date axis shows numbers.** Spreadsheet tools sometimes treat dates as serial numbers. Apply a date number format to the axis.

**Tasks appear in the wrong order.** Sort the rows by start date before plotting, and remember that many charting tools draw the first row at the bottom unless you invert the axis.

**The chart is too wide or too narrow.** Adjust the figure size or the axis limits. A 45-day project needs less horizontal room than a two-year program.

## Common Mistakes

- **Using text dates.** A column that looks like dates but is stored as text will break sorting and axis scaling. Fix it by converting the column to a real date type before you build the chart.
- **Treating duration as inclusive of both endpoints.** If a task starts on the 4th and lasts 5 days, the bar ends on the 9th, not the 8th. Fix it by keeping one consistent convention and applying it to every row.
- **Forgetting to set the axis range.** Leaving the axis on automatic can clip bars or leave huge empty margins. Fix it by setting the minimum to the project start and the maximum to the project end.
- **Mixing summary rows with task rows.** A parent row that spans its children will double-count the work visually. Fix it by plotting only leaf tasks, or by styling summary bars differently.
- **Ignoring gaps between tasks.** White space between bars is information. Fix it by checking whether each gap is intentional slack or a scheduling error.
- **Not updating the chart when dates change.** A Gantt chart built from hard-coded values goes stale immediately. Fix it by driving the chart from the task table so a date change flows through automatically.

## Limitations

A Gantt chart shows time and sequence. It does not show effort, cost, or who is overloaded. Two tasks can sit side by side on the chart while the same person is assigned to both, and the chart will look perfectly fine. If you need to see capacity, you need a resource view on top of the schedule.

The chart also says nothing about dependencies unless you draw arrows between bars. Without those arrows, a reader cannot tell whether Testing must wait for Development or simply happens to start later. And a bar chart of planned dates is not a forecast. It shows what you intend, not what will happen, so treat it as a communication tool and update it as reality diverges from the plan.

## Frequently Asked Questions

### What is the difference between a Gantt chart and a bar chart?

A standard bar chart compares quantities across categories. A Gantt chart uses horizontal bars to show when each task happens, so the horizontal axis is a date scale and each bar's position and length carry meaning. The drawing technique is similar, but the data and the axis are different.

### Can I create a Gantt chart from start and end dates only?

Yes. If you already have end dates, you do not need durations. Use the start date as the left edge and the difference between end and start as the width. Just keep the convention consistent, because a one-day task can be drawn as a zero-width bar if you subtract naively.

### How do I show task dependencies?

Draw an arrow from the end of the predecessor bar to the start of the successor bar. Most spreadsheet charts cannot do this automatically, so you add the arrows as shapes or switch to project management software that supports dependencies natively.

### How many tasks can a Gantt chart show before it becomes unreadable?

It depends on the height of the chart and the length of the task names. As a rule, if the labels start overlapping or the bars become thinner than the text, group tasks into phases and show the detail in a separate view.

### Should the duration include weekends?

Only if the work actually happens on weekends. Calendar days and working days give different end dates, so decide which one your project uses and apply it to every task. Mixing the two is one of the most common sources of schedule drift.

## References

This article draws on the standard references listed under Further Reading.

## Further Reading

- [Weissgerber TL, Milic NM, Winham SJ et al. (2015). Beyond Bar and Line Graphs: Time for a New Data Presentation Paradigm. PLOS Biology](https://doi.org/10.1371/journal.pbio.1002128)
- [Rougier NP, Droettboom M, Bourne PE (2014). Ten Simple Rules for Better Figures. PLoS Computational Biology](https://doi.org/10.1371/journal.pcbi.1003833)
- [NIST/SEMATECH e-Handbook: Graphical Techniques](https://www.itl.nist.gov/div898/handbook/index.htm)
- [Cleveland WS, McGill R (1984). Graphical Perception: Theory, Experimentation, and Application to the Development of Graphical Methods. Journal of the American Statistical Association](https://doi.org/10.1080/01621459.1984.10478080)
- [Hunter JD (2007). Matplotlib: A 2D Graphics Environment. Computing in Science &amp; Engineering](https://doi.org/10.1109/mcse.2007.55)
- [Wilson G, Bryan J, Cranston K et al. (2017). Good enough practices in scientific computing. PLOS Computational Biology](https://doi.org/10.1371/journal.pcbi.1005510)

## Related Articles

- [How to Make a Gantt Chart in Excel (Step by Step)](/blog/data-analysis/how-to-make-gantt-chart-excel)
- [Stem and Leaf Plot: How to Make and Read One](/blog/data-analysis/stem-and-leaf-plot-guide)
- [How to Make a Box and Whisker Plot (Step by Step)](/blog/data-analysis/how-to-make-box-and-whisker-plot)
- [What Is an XY Graph? Axes, Plotting and Examples](/blog/data-analysis/what-is-an-xy-graph)
- [What Is a Line Plot? Definition and Examples](/blog/data-analysis/what-is-a-line-plot)