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

D2 vs Excalidraw

D2 scores 65.3 (B) on agent readiness against Excalidraw's 54.5 (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 99 diagrams comparisons

Which one, for what

D2 B

Good 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 50
  • Agent ergonomics, 78 against 58
  • Payments & pricing, 60 against 35
  • Maintenance & community, 74 against 44
  • Transparency & trust, 69 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

Good 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

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

Score by category

CategoryWeight this runD2ExcalidrawEdge
Reliability16%206850D2 +18
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%16.26565even
Agent ergonomics13%16.27858D2 +20
Security & auth14%17.54873Excalidraw +25
Payments & pricing10%12.56035D2 +25
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%8.87444D2 +30
Transparency & trust7%8.86963D2 +6
Negative events≤150-2
Total65.3 · B54.5 · C

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 found in the text
Terms restrict automated accessyes
Terms restrict benchmarkingnot found in the text
Terms or service can change without noticeyes
Arbitration or class-action waiveryes
Popularity26k stars, 22k npm/wk134k stars, 676k npm/wk

Verdicts

D2

A single local command turns text into a diagram in six formats with no account, key or network call, and CI passes on the default branch. The language is at 0.9.0 with no stable release, its company sponsor has shut down, and one maintainer with limited time wrote every commit since July.

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.

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 65.3 (B) on agent readiness against Excalidraw's 54.5 (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.