Expert Guide

The Best Diagram as Code Tools in 2026

Ten diagram-as-code tools compared on what a paid tier actually adds, since most of the category ships free, with prices checked on vendor pricing pages in September 2026.

Product links may be affiliate links. How we rate 10 tools compared
TL;DR

The best diagram-as-code tool for most developers in 2026 is Mermaid. It's free, MIT-licensed, and rendered natively by GitHub, GitLab and Notion, with the hosted Mermaid Chart Plus tier starting at $10/user/mo billed annually. PlantUML, Graphviz and D2 are also fully free and open source, with no paid tier at all.

Pick Diagrams (mingrammer) to generate cloud architecture diagrams straight from Python, and Excalidraw or draw.io when a teammate needs to hand-edit the result. Eraser ($15/member/mo Starter) and Ilograph ($18/mo Pro) are the paid SaaS options, built for AI-assisted or multi-perspective architecture diagrams. Structurizr's hosted cloud service is being shut down with no replacement, so its only paid path now is a self-hosted server priced in GBP.

Key facts10 tools compared: Mermaid, draw.io (diagrams.net), Excalidraw, PlantUML, Graphviz, D2…
  • Updated: September 25, 2026
  • Top pick: Mermaid (best for: Teams that want a diagram GitHub, GitLab and Notion already render with no extension)
  • Top pick price as of September 25, 2026: Mermaid: Free, MIT license (Mermaid.js); Mermaid Chart Plus $10/user/mo, Premium $20/user/mo, both billed annually.
  • 10 tools compared: Mermaid, draw.io (diagrams.net), Excalidraw, PlantUML, Graphviz, D2, Diagrams (mingrammer), Eraser, Structurizr, Ilograph
  • draw.io (diagrams.net) (best for: Teams that want a real diagram editor with zero license cost and zero vendor lock-in): Free forever, Apache 2.0 license; no paid tier, no Enterprise SSO upsell.
  • Excalidraw (best for: Teams that want a hand-drawn look for architecture sketches, not a polished formal diagram): Free, MIT license; Excalidraw+ Plus $6/mo per user, billed monthly (annual billing saves 14%).
  • PlantUML (best for: Teams that need dense UML: class, sequence, state and component diagrams from a compact text syntax): Free, LGPL-3.0 license; no paid tier or hosted product.

A diagram as code tool turns a text file, or in one case a Python script, into a rendered diagram. The diagram then lives in version control next to the system it describes, updating in the same pull request.

That is the whole pitch against a drag-and-drop canvas: no drift between the doc and the architecture, and a diff you can actually review.

Toolradar data: the directory homepage lists 10,797+ tools across 401+ categories, checked 25 September 2026.

Its closest tracked category, best diagramming tools, evaluated 53 diagramming tools to build that ranking, checked September 2026.

That list leans toward whiteboard tools like Miro and Lucidchart rather than code-first ones, so open Mermaid, draw.io, Excalidraw and Eraser there for the wider catalog listing.

How we ranked: ten tools, each read on its own site or GitHub repository on 25 September 2026.

The order follows license and cost, whether a CI pipeline can render the output without a browser, and what a paid tier buys once the free path runs out.

A whiteboard-first tool like Miro or Lucidchart is a different buy than a text file your CI renders on every push.

That comparison lives in the diagram tools guide on Toolradar.

Top Picks

Based on features, real-world fit, and value for money.

Best Diagram as Code Tools in 2026: 10 tools compared, updated Sep 2026
ToolPricingBest for
MermaidFree, MIT license (Mermaid.js); Mermaid Chart Plus $10/user/mo, Premium $20/user/mo, both billed annually.Teams that want a diagram GitHub, GitLab and Notion already render with no extension
draw.io (diagrams.net)Free forever, Apache 2.0 license; no paid tier, no Enterprise SSO upsell.Teams that want a real diagram editor with zero license cost and zero vendor lock-in
ExcalidrawFree, MIT license; Excalidraw+ Plus $6/mo per user, billed monthly (annual billing saves 14%).Teams that want a hand-drawn look for architecture sketches, not a polished formal diagram
PlantUMLFree, LGPL-3.0 license; no paid tier or hosted product.Teams that need dense UML: class, sequence, state and component diagrams from a compact text syntax
GraphvizFree, Eclipse Public License 2.0; no paid tier or hosted product.Teams that need the underlying graph-layout engine other diagram tools build on top of
D2Free, MPL-2.0 license; Terrastruct lists no paid tier for D2 today.Teams that want a modern syntax with built-in themes, sketch mode and animated diagrams
Diagrams (mingrammer)Free, MIT license; a Python library, no paid tier or hosted product.Teams that want cloud architecture diagrams generated from a Python script, not drawn by hand
EraserFree (3 files, 3 AI diagrams); Starter $15/member/mo annual ($20 mo); Business $45/member/mo annual ($60 mo).Teams that want AI-generated diagrams alongside Markdown docs in one collaborative workspace
StructurizrCloud service end of life, no replacement; self-hosted server from £300/mo, 1-20 users, billed annually; no USD price.Teams already committed to the C4 model who can self-host, not new teams starting today
IlographFree ($0/mo, 14-day diagram history); Pro from $18/mo (annual) or $22/mo (monthly); Team from $25/editor/mo (annual).Teams that need one architecture model to generate several interactive, zoomable perspectives

Pricing read from each vendor's own published pricing page, checked Sep 2026. Every vendor here publishes a price.

Lowest published monthly priceMermaid$10Excalidraw$6PlantUMLFreeGraphvizFreeD2FreeDiagrams (mingrammer)FreeEraser$15IlographFree
Lowest monthly figure each vendor publishes, checked Sep 2026. A tilde marks a figure the vendor states approximately. Per-seat and usage charges can sit on top of it. 2 of 10 do not publish a comparable monthly price and are left out rather than estimated.

Best for: Teams that want a diagram GitHub, GitLab and Notion already render with no extension

PricingFree, MIT license (Mermaid.js); Mermaid Chart Plus $10/user/mo, Premium $20/user/mo, both billed annually.

+MIT-licensed core library with 90,000+ GitHub stars, free forever with no rendering limit
+Native rendering in GitHub markdown, GitLab and Notion, so most diagrams need no separate viewer
+Mermaid Chart's Plus tier removes the free plan's 3-diagram cap and adds AI generation credits
−The free Mermaid Chart plan caps at 3 diagrams and limited diagram size, a real wall for anyone using the hosted editor daily
−Complex sequence or class diagrams get unreadable fast; PlantUML handles denser UML better
Visit Mermaid →

Best for: Teams that want a real diagram editor with zero license cost and zero vendor lock-in

PricingFree forever, Apache 2.0 license; no paid tier, no Enterprise SSO upsell.

+Apache 2.0 licensed, with the vendor stating outright there is no Enterprise tier gating SSO
+Diagrams saved in 2005 still load today, so files never go stale against an old app version
+Confluence, Jira, Google Workspace, Microsoft 365 and VS Code integrations ship free, not gated
−Not diagram-as-code in the strict sense: the source is an XML file edited on a canvas, not a text language you'd write by hand
−No built-in CI rendering step; scripting a headless export takes extra tooling
Visit draw.io (diagrams.net) →

Best for: Teams that want a hand-drawn look for architecture sketches, not a polished formal diagram

PricingFree, MIT license; Excalidraw+ Plus $6/mo per user, billed monthly (annual billing saves 14%).

+MIT-licensed with 132,000+ GitHub stars, and the free tier already includes unlimited collaborators
+Mermaid-to-Excalidraw import turns a text diagram into an editable sketch, bridging the two workflows
+Plus is the cheapest paid tier of any tool on this list, well under Mermaid Chart's or Eraser's entry price
−The free tier caps at 1 infinite scene; Plus is required for unlimited scenes and folders
−Hand-drawn style reads as informal for a customer-facing architecture doc
Visit Excalidraw →

Best for: Teams that need dense UML: class, sequence, state and component diagrams from a compact text syntax

PricingFree, LGPL-3.0 license; no paid tier or hosted product.

+Free and open source (LGPL-3.0), with 13,000+ GitHub stars and two decades of UML syntax coverage
+Renders sequence, class, state, component, and deployment diagrams, more UML diagram types than Mermaid covers
+Runs locally via a JAR file or Docker image, so CI rendering needs no network call to a hosted server
−Syntax is denser and less forgiving than Mermaid's for a newcomer's first flowchart
−No native rendering in GitHub or GitLab; needs a plugin, proxy server, or pre-rendered image
Visit PlantUML →

Best for: Teams that need the underlying graph-layout engine other diagram tools build on top of

PricingFree, Eclipse Public License 2.0; no paid tier or hosted product.

+Free under the Eclipse Public License 2.0, with no commercial edition to weigh against it
+The DOT language it introduced is the layout engine several tools on this list (PlantUML, Diagrams) render through
+Handles large, densely connected graphs that hierarchical tools like Mermaid struggle to lay out cleanly
−DOT syntax is lower-level than Mermaid or D2; positioning and styling take more trial and error
−No native theming system; visual polish requires manual attribute tuning
Visit Graphviz →
6

D2

Best for: Teams that want a modern syntax with built-in themes, sketch mode and animated diagrams

PricingFree, MPL-2.0 license; Terrastruct lists no paid tier for D2 today.

+Free under the Mozilla Public License 2.0, with 25,000+ GitHub stars on the d2lang/d2 repository
+Ships professionally designed themes and a sketch mode out of the box, ahead of Mermaid or PlantUML's default styling
+Exports to SVG, PNG, PDF, PPTX, GIF and even ASCII, and offers three interchangeable layout engines
−Terrastruct's own pricing page now redirects straight to the D2 project site, so there is no separate paid product to compare
−Smaller ecosystem and fewer native integrations than Mermaid, which GitHub and GitLab render without a plugin
Visit D2 →

Best for: Teams that want cloud architecture diagrams generated from a Python script, not drawn by hand

PricingFree, MIT license; a Python library, no paid tier or hosted product.

+MIT licensed with built-in icon sets for AWS, Azure, GCP, Kubernetes and on-prem systems, no manual icon hunting
+Diagrams live as Python functions, so the same code review and version control process covers infrastructure and its diagram
+42,000+ GitHub stars and active maintenance make it the most established Python option for this specific job
−Only outputs static PNG images; no interactive viewer or hosted sharing link
−Requires Graphviz installed as a system dependency, an extra setup step compared to a single binary
Visit Diagrams (mingrammer) →
8

Best for: Teams that want AI-generated diagrams alongside Markdown docs in one collaborative workspace

PricingFree (3 files, 3 AI diagrams); Starter $15/member/mo annual ($20 mo); Business $45/member/mo annual ($60 mo).

+Diagram-as-code syntax plus AI generation in one workspace, with GitHub, Notion, Confluence and VS Code integrations even on Free
+Starter opens up unlimited files and 40 AI diagrams a month once the free cap gets tight
+Business adds SAML SSO and unlimited version history at $45/member/mo annually, cheaper than most competing team wikis
−The free plan caps at 3 files total, not 3 diagrams a month, so it stops being usable fast for a real project
−AI diagram count is a hard quota (40 on Starter, 250 on Business) rather than unlimited until Enterprise
Visit Eraser →

Best for: Teams already committed to the C4 model who can self-host, not new teams starting today

PricingCloud service end of life, no replacement; self-hosted server from £300/mo, 1-20 users, billed annually; no USD price.

+Defined the C4 model (context, container, component, code) that several other tools on this list, including Ilograph, support exporting to
+One DSL source generates multiple views (context, container, deployment) instead of separate files per diagram
+Structurizr Lite and the new 'local' command line workflow remain free for a single developer working offline
−The Structurizr cloud service is end of life with no replacement, confirmed on the vendor's own documentation in September 2026
−The only current paid product, Structurizr server, is priced in GBP (from £300/mo for 1-20 users, billed annually) with no USD list price published
Visit Structurizr →

Best for: Teams that need one architecture model to generate several interactive, zoomable perspectives

PricingFree ($0/mo, 14-day diagram history); Pro from $18/mo (annual) or $22/mo (monthly); Team from $25/editor/mo (annual).

+One model generates multiple interactive, clickable perspectives, closer to a live system map than a static image
+The free plan has no diagram-count cap, only a 14-day history window, generous for solo use
+Ilograph Desktop ($11.99 to $14.99/mo depending on billing) offers an offline, on-premises option for teams behind a firewall
−Team pricing runs per editor per month ($25 to $30), which adds up faster than Eraser's or Mermaid Chart's per-user rate at small team sizes
−SSO is locked behind the custom-quote Team+ tier, not available at any published price
Visit Ilograph →

What it is

Diagram as code means the diagram's source is plain text (or, for Diagrams, Python) that a renderer turns into an SVG, PNG or PDF. The source is diffable, reviewable in a pull request, and reproducible on any machine that has the renderer installed, unlike a file saved inside a proprietary canvas app.

The category splits into two camps.

General-purpose text-to-diagram languages (Mermaid, PlantUML, D2, Graphviz) draw flowcharts, sequence diagrams and graphs from a compact syntax.

Architecture-specific tools (Structurizr, Ilograph, Diagrams) model a system's structure, usually against the C4 model or a cloud provider's icon set, and generate several views from one source.

Excalidraw and draw.io sit at the edge of the category: both are canvas editors first, with a code-like layer (Mermaid-to-Excalidraw import, an XML/JSON file format) bolted on rather than built in.

Why it matters

Every tool on this list except three is free with no paid tier at all. PlantUML (LGPL-3.0), Graphviz (Eclipse Public License 2.0), D2 (MPL-2.0) and Diagrams (MIT) publish no commercial product at all.

The real decision is which syntax your team will actually keep writing, not which invoice is smaller.

Mermaid's core library is MIT-licensed and free; its maker sells the hosted Mermaid Chart on top once the free plan's 3-diagram cap gets in the way.

Devshot data: 28,000 developer readers get this brief, and the audience file updated 20 September 2026 puts the open rate at 30%.

For that audience, the tool that renders in CI without a browser usually beats one that only works inside a hosted editor. Mermaid, PlantUML, Graphviz, D2 and Diagrams all do this, via a CLI. Structurizr is the cautionary case here.

Its cloud service is end of life with no replacement, confirmed on the vendor's own docs in September 2026, so a team that built workflows around it now needs to migrate to the self-hosted server product or a local export.

Latency and lock-in are the other axis.

A CLI tool you run in a GitHub Action never depends on a vendor's uptime. A hosted SaaS like Eraser or Ilograph trades that independence for AI generation, team libraries and a shareable link.

The CI/CD tools guide and the Git clients guide cover the pipelines these diagrams usually render inside.

Key features to look for

License and costEssential
Seven of the ten tools here are fully free and open source with no paid tier. The three that sell a hosted product (Mermaid Chart, Eraser, Ilograph) charge for AI generation, team collaboration or version history, not the base rendering.
Renders in CI without a browserEssential
Mermaid, PlantUML, Graphviz, D2 and Diagrams all ship a CLI or library that renders a diagram in a GitHub Action or a build step. Excalidraw, draw.io, Eraser and Ilograph are built around an interactive editor first.
What the diagram modelsEssential
General-purpose languages (Mermaid, PlantUML, D2, Graphviz) draw flowcharts and sequence diagrams. Structurizr and Ilograph model whole software architectures against the C4 model. Diagrams generates cloud infrastructure diagrams from Python, with built-in AWS, Azure and GCP icon sets.
Native rendering support
GitHub, GitLab and Notion all render Mermaid blocks natively, with no extension required. PlantUML, D2 and Graphviz need a renderer, an extension, or a build step to appear inline.
AI diagram generation
Eraser's paid tiers add AI-generated diagrams (3 free, 40 on Starter, 250 on Business) from a text prompt. Mermaid Chart's Plus and Premium tiers scale AI credits the same way. The free, code-only tools have no built-in AI generation step.

Pricing

Seven of these ten tools are fully free with no paid tier at all. PlantUML (LGPL-3.0), Graphviz (Eclipse Public License 2.0), D2 (MPL-2.0), Diagrams (MIT), draw.io (Apache 2.0), and the core Mermaid and Excalidraw libraries (both MIT) all ship under a permissive license with no commercial edition to buy.

The decision for those seven is syntax and rendering fit, not price.

Mermaid Chart, the hosted product built on top of free Mermaid, is the cheaper of the two per-seat SaaS plans built on an open-source base.

A higher Premium tier exists for teams that need more AI credits. Excalidraw+ undercuts it further, the cheapest paid tier on the page, with a 14% discount for annual billing.

Eraser and Ilograph are the two dedicated paid SaaS products.

Both scale from a mid-teens monthly seat price on their entry paid tier toward a team plan in the twenties to forties per seat; the pricing table below has the exact figures and billing terms. Structurizr is the outlier.

Its cloud service is end of life with no replacement, and the surviving Structurizr server product publishes prices only in GBP, from £300/mo for 1-20 users billed annually, with no USD figure on its pricing page as of September 2026.

PlanPriceBest for
Mermaid (core library)FreeMIT license, no diagram or usage limit
Mermaid Chart BasicFree3 diagrams, limited size, limited AI credits
Mermaid Chart Plus$10/user/mo billed annuallyUnlimited diagrams, 300 AI credits a year
Mermaid Chart Premium$20/user/mo billed annually2,000 AI credits a year, unlimited viewer seats
Mermaid Chart EnterpriseCustom quoteSSO, custom contract, dedicated CSM
draw.io (diagrams.net)FreeApache 2.0, no paid tier of any kind
Excalidraw (core app)FreeMIT license, 1 infinite scene, unlimited collaborators
Excalidraw+ Plus$6/mo per userBilled monthly; annual billing saves 14%
PlantUMLFreeLGPL-3.0, no paid tier or hosted product
GraphvizFreeEclipse Public License 2.0, no paid tier
D2FreeMPL-2.0; Terrastruct's pricing page redirects to the D2 project site
Diagrams (mingrammer)FreeMIT license, Python library, no paid tier
Eraser Free$0/member/mo3 files, 3 AI diagrams, 7-day version history
Eraser Starter$15/member/mo annual ($20 monthly)Unlimited files, 40 AI diagrams, 90-day history
Eraser Business$45/member/mo annual ($60 monthly)250 AI diagrams, SAML SSO, unlimited history
Eraser EnterpriseCustom quoteUnlimited AI diagrams, flexible deployment
Structurizr server, 1-20 users£300/mo billed annuallyNo USD list price published; self-hosted, cloud service is end of life
Structurizr server, 1,001+ users£2,400/mo billed annuallyTop published server tier; contact for 251+ team pricing above 1,000
Ilograph Free$0/moUnlimited diagrams, 14-day history
Ilograph Pro$18/mo annual ($22/mo monthly)Custom icons, unlimited history, 20 private viewers
Ilograph Team$25/editor/mo annual ($30/editor/mo monthly)Team workspace, unlimited viewers
Ilograph Team+Custom quoteSSO via SAML 2.0, API access
Ilograph Desktop$11.99/mo annual ($14.99/mo monthly)Offline desktop app, works with local files
Mistakes to avoid
×Adopting Structurizr's cloud service for a new project in 2026. It is end of life with no replacement, per the vendor's own documentation, so a new team should start on Structurizr's local workflow or the self-hosted server instead.
×Assuming a diagram-as-code tool renders in CI just because it renders in a browser. Eraser and Ilograph are built around a hosted editor; Mermaid, PlantUML, Graphviz, D2 and Diagrams all ship a CLI or library that renders headless.
×Comparing Mermaid Chart's or Eraser's monthly SaaS price against PlantUML's or Graphviz's $0 as if they compete on the same axis. Seven tools on this list are free forever; the paid three sell AI generation and team collaboration on top of a category that is mostly free by default.
Expert tips
→Start with Mermaid for anything that needs to render inline in a GitHub README or a Notion doc, since neither PlantUML nor D2 renders natively there without an extension.
→If the team already writes infrastructure in Python, generate the architecture diagram with Diagrams (mingrammer) directly from that code instead of hand-drawing it in a separate tool that will drift out of sync.
→Before paying for Eraser's or Ilograph's AI generation, check whether ChatGPT or Claude can already output valid Mermaid or D2 syntax for the same prompt. Both text-to-diagram languages are common enough in LLM training data that a free chat tool often gets close on the first try.

The bottom line

Default to Mermaid for most day-to-day diagrams: it is free, MIT-licensed, and the only tool here GitHub, GitLab and Notion render natively.

Reach for PlantUML when a diagram needs deep UML support, and Graphviz or D2 when the layout itself, not the notation, is the hard part.

Use Diagrams when the source of truth is already Python, and Excalidraw or draw.io when a non-technical teammate needs to hand-edit the result.

Pay for Eraser or Ilograph only once a team genuinely needs AI generation or multi-perspective modeling; check Structurizr's end-of-life notice before building anything new on its cloud service. Cite this: Devshot, "Best Diagram as Code Tools in 2026", September 2026.

Frequently asked questions

What is the best diagram-as-code tool in 2026?
Mermaid is the default for most developers: free, MIT-licensed, and rendered natively by GitHub, GitLab and Notion with no plugin, checked on mermaid.js.org and mermaid.ai in September 2026. PlantUML is the strongest pick for dense UML diagrams, and Diagrams (mingrammer) is the best fit when the diagram should be generated from existing Python infrastructure code.
Is Mermaid free?
Yes. The core Mermaid.js library is MIT-licensed and free with no usage limit, checked on GitHub in September 2026. The hosted Mermaid Chart product has a free Basic plan capped at 3 diagrams, with Plus starting at $10/user/mo billed annually and a pricier Premium tier above it for larger teams and more AI credits.
Is there a free diagram-as-code tool?
Most of the category is free: Mermaid, PlantUML, Graphviz, D2, Diagrams, Excalidraw and draw.io all publish a permissive open-source license (MIT, LGPL-3.0, Eclipse Public License 2.0, or MPL-2.0) with no usage cap on the base tool. Only Mermaid Chart, Eraser and Ilograph sell a separate paid tier on top of a free plan.
Mermaid vs PlantUML: which should I use?
Mermaid for anything that needs to render inline in GitHub, GitLab or Notion without a plugin, and for simpler flowcharts, sequence and Gantt diagrams. PlantUML for denser UML work, class and component diagrams especially, where its two-decade head start on syntax coverage shows. Both are free and open source, so the choice is about syntax and where the diagram needs to display, not cost.
What happened to Structurizr's cloud service?
Structurizr's hosted cloud service, along with Structurizr Lite, the Structurizr CLI, and the old on-premises installer, are end of life with no replacement for the cloud service specifically, confirmed on the vendor's own documentation in September 2026. The surviving paid product is Structurizr server, a self-hosted option priced in GBP, from £300/mo for 1-20 users billed annually, with no USD price published.
Can I generate a diagram from Python or another programming language?
Diagrams (mingrammer) generates AWS, Azure, GCP and on-prem architecture diagrams directly from a Python script, and is free under the MIT license. D2 and Graphviz both offer language APIs and CLI tools that other programs can call. Mermaid and PlantUML are primarily text languages rather than libraries, though wrapper packages exist in most languages to generate their syntax programmatically.
What is the cheapest paid diagram tool here?
Excalidraw+ Plus, at $6/mo per user (billed monthly, with a 14% discount for annual billing), is the cheapest paid tier on this list, checked on plus.excalidraw.com in September 2026. Ilograph's Desktop plan is close behind at $11.99 to $14.99/mo depending on billing term. Both sit well under Eraser's or Mermaid Chart's entry-level seat price.
Related guides

Some offers on this page may be paid placements or contain affiliate links.

Get the Devshot brief

Free daily newsletter, read in 5 minutes.

Subscribe free