Head to head · Diagrams as code · October 2026 research run

D2 vs Excalidraw

D2 scores 66.1 (B) on agent readiness against Excalidraw's 54.8 (C), and leads in 5 of 7 scored categories. Excalidraw leads on security & auth. Both do diagrams as code.

Best diagramming APIs and diagram-as-code for AI agents · All 150 diagrams comparisons

Which one, for what

D2 B

Best for Agents that need to produce or edit architecture, sequence, grid, SQL table or class diagrams as reviewable text and render them locally.

Ahead on

  • Reliability, 68 against 30
  • Agent ergonomics, 78 against 58
  • Payments & pricing, 90 against 53
  • Maintenance & community, 74 against 44
  • Transparency & trust, 70 against 63

Also in its favour

  • No key needed to call it

Watch for

No 1.0 release. The maintainer lists a stable 1.0 with a formal grammar as a goal, and 0.8.2 changed Dagre and ELK layout output

Excalidraw C

Best for Teams already on Excalidraw+ that want agents to create and edit hand-drawn diagrams, slides and wireframes in a shared workspace, and one-off sketches through the free MCP App.

Ahead on

  • Security & auth, 73 against 48

Also in its favour

  • A hosted endpoint, with nothing to install
  • No incidents deducted, where D2 loses 3 points for them

Watch for

The API and MCP server are in public beta. The docs say endpoints, tool names and schemas may change and to expect breaking changes

Why the edge

Each category where one leads by five points or more, with the reason behind each side's score from its assessment. The numbers are in the table below; this is what they stand for.

Reliability D2 +38

D2 68

Read with the local-software lines, because D2 runs on the owner's machine. Install script, Homebrew, release archives for six platforms, Docker and npm, with macOS 13 and Go 1.27 stated (20). The ci workflow passed on the last four pushes to the default branch, the latest on 2 October 2026, per the 8 October check (GitHub's pages and API refuse our requests on 2 November), and the repository holds 497 Go test files (25). GitHub counted 535 open issues and pull requests on 8 October, and the five outside issues opened since 13 September had no reply (12, per the 8 October check). Release notes exist for each version and warn of layout changes, though versions are 0.x and we found no note for the Go import path moving to github.com/d2lang/d2 (11). The latest release is 0.9.0, and the maintainer lists a stable 1.0 as a goal (0).

Excalidraw 30

Scored on the hosted lines for the Excalidraw+ API and MCP server. Excalidraw's terms of use (in effect 1 June 2022) forbid accessing the Site by automated or non-human means, so its hosts weren't read on 4 November and the docs readings below are per the 9 October check, not re-read. A status page exists at status.excalidraw.com, but its robots.txt disallows every path (re-read 4 November), so no component history has ever been read (0). No incident history could be read (5). The rate limit is 600 requests a minute per IP, with X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers (15). The docs ask for backoff on 429 and show a retry that waits for the reset time, with no idempotency keys or safe-retry guidance on writes (10). No SLA found (0). Both surfaces are in public beta (0). 0 + 5 + 15 + 10 + 0 + 0 = 30.

Payments & pricing D2 +37

D2 90

Read with the self-hosted rule. Free MPL-2.0 software with nothing to buy and no payment protocol (0). No price to publish (20). No card or trial needed (20). An agent can install and run it with no signup (20). Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 60 is 90.

Excalidraw 53

No x402, MPP or L402 (0). Plan prices are public, Free at $0 and Plus at $6 a user a month, with no per-call price (10). The free editor and the keyless MCP App need no card, while the API needs the Plus plan, whose 14-day trial does not say whether a card is taken; the terms (re-read 4 November) say the account is charged when the trial ends (15). The MCP App's README gives https://mcp.excalidraw.com as a remote server to add as a custom connector, with no key, but an API key is created by a person in workspace settings (10). Pricing per the 9 October check, not re-read on 4 November. 0 + 10 + 15 + 10 = 35. Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 35 is 53.

Maintenance & community D2 +30

D2 74

Release 0.9.0 on 7 September 2026, 56 days before this check, and no release since (20). Five tagged versions since 4 August, 0.7.2, 0.8.0 and 0.8.1 on 6 August, 0.8.2 on 24 August and 0.9.0 (20); the three 6 August versions leave the 90-day window after 4 November. All 317 commits from 8 July to 8 October were by one maintainer, who wrote on 5 September that his time is limited; six more commits by him followed on 11 October and none since, and outside issues opened since 13 September had no reply on 8 October (10). The Go library and @d2lang/d2 0.1.34 match 0.9.0 (15). Go 1.27, dependencies refreshed in 0.8.2 and CI on every push (9). 20+20+10+15+9 = 74.

Excalidraw 44

The newest changelog entry is dated 1 September 2026, 64 days before this check, per the 9 October reading (20); the changelog wasn't re-read on 4 November (terms ban automated access). The editor package @excalidraw/excalidraw has no release since 0.18.1 (20 April 2026), and the MCP App's newest tag is v0.3.2 (9 February 2026), both read from clones. Of the dated entries recorded, only 1 September falls in the 90 days from 6 August (0). A public changelog, a roadmap, a Discord server and support@excalidraw.com exist, and the editor repository had commits up to 3 November 2026 (12). There is no SDK for the API, and the editor package on npm is the vendor's only official package (5). The editor repository runs test, lint and size workflows, and the MCP App repository has no CI and no commit since 24 March 2026 (7). 20 + 0 + 12 + 5 + 7 = 44.

Security & auth Excalidraw +25

D2 48

No credential exists to leak or scope (20). The CLI runs with the owner's file and network rights. Release 0.9.0 reads local imports and fetches remote images when bundling, and the private-network block and rooted file policy sit unreleased on the default branch. --bundle=false avoids fetches (8). The tool renders the caller's own text and returns no third-party content (10). --debug logs only (3). No SECURITY.md, security.txt or published advisories. Release archives carry checksums, signed provenance and SBOM attestations, CI actions are pinned by hash, and about 30 hardening pull requests merged on 11 and 12 September 2026 (7).

Excalidraw 73

API keys are workspace-bound, take read or full permission or specific routes, carry an expiry and can be rotated or soft-deleted. Personal and workspace keys differ in access to private collections (30). Read-only keys expose only read tools and deletes go to trash, with no confirmation step found (14). Scene text written by collaborators returns to the model and add_image fetches a public URL, with no injection guidance found (3). GET /logs returns the workspace audit log with filters by user, action and operation (13). Excalidraw states SOC 2 Type 1 and Type 2, yearly penetration tests and Vanta scanning, and publishes advisories on GitHub (OSV lists five for the editor, the newest on 24 April 2026). That newest one, GHSA-39h7-pwv7-rc3x, covers Mermaid's own sequence-diagram flaw (CVE-2025-54881, published by Mermaid on 19 August 2025), fixed in 0.18.1 by a dependency update, so it takes no deduction; the other four are older than twelve months. No security.txt, bug bounty or SECURITY.md was found, and the trust centre report was not read (13). Docs readings per the 9 October check, not re-read on 4 November. 30 + 14 + 3 + 13 + 13 = 73.

Agent ergonomics D2 +20

D2 78

One command with text in and a diagram out, and no tool definitions to load (22). --target renders one board, --scale sizes the output and ASCII output suits a text-only reader (14). d2 validate and d2 fmt --check report problems before rendering, and the man page tells callers to rely on the exit status. No list of error codes (13). Rendering is a pure function of the input for Dagre and ELK, TALA is seeded, and d2oracle returns new graphs instead of mutating. A partial file can be written on error (15). d2 in.d2 works with no flags, and official libraries exist for Go and JavaScript (14).

Excalidraw 58

The docs list 37 MCP tools (5). The server shows a key only the tools its routes allow, so a read-only or route-restricted key cuts the list (7). Lists take offset and limit up to 100, logs take a cursor and filters, and search_scene_content returns only matching elements (18). Errors are JSON with statusCode, error and message, and seven status codes are documented (13). No idempotency keys. Deletes of scenes and collections move them to trash, and MCP annotations could not be read (8). create_diagram measures labels and routes arrows, but there is no SDK for the API (7). Per the 9 October check, not re-read on 4 November. 5 + 7 + 18 + 13 + 8 + 7 = 58.

Transparency & trust D2 +7

D2 70

MPL-2.0 for the language, the renderers and TALA (30). No privacy policy, and the software runs locally. The FAQ says the CLI uses no network after install apart from a version check, and the playground runs in the browser through WebAssembly (18). Release notes mark deprecated Go and d2.js entry points as callable for one more release, and the @terrastruct/d2 package and terrastruct/d2 image stay as mirrors, with no dates given (12). The FAQ states there is no telemetry. We found no documented switch for the version check (14).

Excalidraw 63

The graded service is closed under public terms of use, while the editor and the MCP App are MIT (20). The privacy policy of 29 April 2021 says servers are in the United States and data is kept at most one month after an account ends. The DPA of 13 January 2026 says cancelling a subscription does not delete data and retention follows internal policies. Neither names AI providers (14). No deprecation policy, only the beta warning that contracts may break (3). The DPA points to a sub-processor list at trust.excalidraw.com, which is script-drawn and was not read, and says some sub-processors are in the United States (8). The terms were re-read on 4 November (published 30 May 2022, in effect 1 June 2022); the other documents per the 9 October check. 20 + 14 + 3 + 8 = 45.

Score by category

CategoryWeightD2ExcalidrawEdge
Reliability16%6830D2 +38
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%6565even
Agent ergonomics13%7858D2 +20
Security & auth14%4873Excalidraw +25
Payments & pricing10%9053D2 +37
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%7444D2 +30
Transparency & trust7%7063D2 +7
Negative events≤15-30
TotalB 66.1/100C 54.8/100

Facts side by side

FactD2Excalidraw
KindSDK + MCPHTTP API
VendorD2 project (The Hack Foundation)Excalidraw s.r.o.
Hosted endpointno (local only)https://api.excalidraw.com/api/v1/mcp
TransportsHTTP, Streamable HTTP
AuthNoneAPI key
PricingFreeFreemium
x402nono
LicenceMPL-2.0Excalidraw+ is a proprietary service under Excalidraw's terms of use. The editor and the MCP App on GitHub are MIT
Tools exposednone37
Read-only variant documentednono
llms.txtnoyes
Last release2026-09-072026-09-01
Terms last updatedno document linkedno date given
Privacy policy last updatedno document linked2021-04-29
Customer content may train modelsnot read yetnot found in the text
Terms restrict automated accessnot read yetyes
Terms restrict benchmarkingnot read yetnot found in the text
Terms or service can change without noticenot read yetyes
Arbitration or class-action waivernot read yetyes
Popularity26k stars, 22k npm/wk134k stars, 676k npm/wk
Agent reviews3.5/5 (4)none

How the scores have moved

Verdicts

D2

A single local command turns text into a diagram in six formats with no account, key or network call. The language is at 0.9.0 with no stable release, its company sponsor has shut down, and security fixes merged in September 2026 were still unreleased on 2 November.

Excalidraw

Excalidraw+ keys carry read or full permission, route restrictions and an expiry, and the MCP server shows a key only the tools its routes allow. The API and MCP server are in public beta with breaking changes expected, sit behind the $6 Plus plan, and have no published OpenAPI file, SDK or idempotency keys. No status history can be read.

Before you call either

D2

  1. Check the exit status of d2, never the output file. The man page says a partial render can be written when an error occurs
  2. Run d2 validate file.d2 before rendering, and d2 fmt to normalise the source
  3. Pass - for input and output and set --stdout-format (svg, png, ascii, txt, pdf, pptx or gif) to work without files
  4. Use --stdout-format ascii when the reader is a text-only model
  5. Pass --bundle=false or review image URLs and imports before rendering D2 text from an untrusted source. Release 0.9.0 fetches remote images when bundling

Excalidraw

  1. Send Authorization: Bearer <API_KEY> to https://api.excalidraw.com/api/v1. For MCP, use POST /api/v1/mcp only. The server is stateless and answers 405 to other methods
  2. Use a personal key to reach the owner's private collection with the collection ID private. A workspace admin must enable personal keys first
  3. Call read_diagram_format, read_presentation_format or read_freeform_format before the first scene write in a session
  4. Write with edit_scene_content and bind arrows through startBinding and endBinding with tempId references. PUT /scenes/{sceneId}/content removes every element left out of the request
  5. Stay under 600 requests a minute per IP and wait until X-RateLimit-Reset after a 429

Questions

Which is better for AI agents, D2 or Excalidraw?

D2 scores 66.1 (B) on agent readiness against Excalidraw's 54.8 (C), and leads in 5 of 7 scored categories. Excalidraw leads on security & auth.

Can an agent call D2 and Excalidraw without installing anything?

No hosted endpoint is listed for D2. Excalidraw has a hosted endpoint at https://api.excalidraw.com/api/v1/mcp.

Are D2 and Excalidraw open source?

Yes. D2 is open source (MPL-2.0). Excalidraw is open source (Excalidraw+ is a proprietary service under Excalidraw's terms of use. The editor and the MCP App on GitHub are MIT).

Other comparisons with D2 or Excalidraw

Machine-readable

For companies

Do agents find, use and choose your tools?

An agent-readiness audit runs our probes, task suite and eight reviewer agents against your public and internal tools, and comes back with a scorecard, the transcripts of what failed, and a fix list in priority order. From $2,500, re-run included. We never take payment to move a rank. We do help companies earn one.