← Directory

D2

Open Source
★ 24,041 • Updated Aug 15, 2026, 07:28 PM

D2 is a modern, open-source diagram scripting language that enables users to define diagrams using a simple, readable text syntax.

Use Cases ▼
01

Software architecture diagrams

02

Network topology diagrams

03

Flowcharts and process diagrams

04

Sequence diagrams

05

Infrastructure-as-code documentation

06

Automated diagram generation in CI/CD pipelines

What Problem It Solves ▼

Creating diagrams manually with drag-and-drop tools is time-consuming and difficult to version control. D2 solves this by allowing users to define diagrams as code, enabling automation, reuse, and consistency across documentation and system designs.

Key Features ▼
✓

Simple, declarative syntax

✓

Fast and lightweight binary

✓

High-quality default themes and layouts

✓

Supports SVG and PNG export

✓

Active open-source community

Overview

D2 is a modern, open-source diagram scripting language that enables users to define diagrams using a simple, readable text syntax. It is designed to be easy to learn while providing the power to create professional-quality diagrams for software architecture, network topology, flowcharts, and more. D2 compiles text into SVG or PNG images, making it suitable for both interactive viewing and static export.

Full Description ▼

The language emphasizes clarity and expressiveness, with features like automatic layout, themes, and support for complex nested structures. D2 is written in Go and is distributed as a single binary, making it lightweight and easy to install across platforms. It also includes a language server protocol (LSP) implementation for editor integration.

D2 is open source and community-driven, hosted on GitHub under the Terrastruct organization. It aims to provide a better alternative to existing tools by offering a balance of simplicity, performance, and visual quality. The project is actively maintained and has gained popularity among developers for creating diagrams as code.

Pros & Cons

Pros

+

Simple, declarative syntax

+

Fast and lightweight binary

+

High-quality default themes and layouts

+

Supports SVG and PNG export

+

Active open-source community

Cons

−

Limited to diagram types supported by the language

−

No built-in graphical editor (text-only)

−

Younger ecosystem compared to mature tools

−

May require learning new syntax for advanced features

Similar Tools

PlantUML Mermaid Graphviz draw.io Structurizr Lucidchart

More in Dev Tools