DiagramPreview
Basic parserD2ArchitecturePreview workspace

D2 Preview

Inspect flat D2 nodes, labels and directed relationships locally, then download SVG/PNG. This basic subset parser does not support containers, styles or true sequence diagrams.

Examples
D2 previewReady
Enter flat nodes or -> relationships to preview.

Continue with a related tool

Compatible tools can carry your current source or converted XML. Other tools open separately.

Design Spec Generator

Generate Markdown design specs, review missing requirements and export a flow diagram.

Open
AI Diagram Generator

Generate Mermaid diagrams from a natural language prompt with AI.

Open
Mermaid AI Fixer

Fix broken Mermaid syntax and improve diagram readability with AI.

Open

How to use

  1. 1Write one node, id: label, or -> chain per line.
  2. 2Use a small service map to check labels and relationship endpoints.
  3. 3Download SVG or PNG from the current successful preview.
  4. 4Use the official D2 renderer for containers, layouts, themes and sequence diagrams.

Common use cases

Flat service mapsSimple dependency graphsProtocol label checksText architecture sketches

FAQ

Is D2 rendering available?

Yes. A local basic parser renders SVG and PNG; it is not the official D2 layout engine.

Which syntax is supported?

Flat nodes, id: label and -> chains, up to 100 nodes and 200 relationships. Labels longer than 22 characters are shortened in the image.

Can I use containers or sequence diagrams?

Containers, attributes, styles, bidirectional/undirected edges and true sequence diagrams are unsupported and rejected. Use the official D2 renderer for these inputs.

Use this page for small service-dependency sketches; source is parsed in the browser.

The basic layout arranges nodes again and is not a pixel-identical substitute for official D2 output.

Check labels and arrows before downloading SVG/PNG. Unsupported syntax or limits block image exports.

Example: five-service dependency map

Use short identifiers for relationships and separate labels for service names. This example uses flat structure only.

  • Five nodes and four relationships.
  • No nested containers or custom shapes.
  • Split larger diagrams and check each part.
web: Web app
api: Order API
db: Database
queue: Event queue
worker: Worker
web -> api: HTTPS
api -> db: SQL
api -> queue: publish
queue -> worker: consume

Review checklist for D2 Preview

Use D2 Preview when you need to inspect source content visually before it becomes documentation, a pull request note, an incident write-up, or a handoff artifact. Preview basic D2 nodes and directed relationships locally, with SVG/PNG exports.

Before exporting, check that labels are readable, relationships match the source, generated examples do not contain private data, and the preview still makes sense after you edit the input.

Limits and troubleshooting

If the preview fails, reduce the input to the smallest complete example, confirm the format syntax, and then add sections back one at a time. Many rendering failures come from partial files, indentation mistakes, missing diagram headers, or copied snippets that depend on hidden context.

Treat the preview as a review surface rather than a source of truth. Generated diagrams, converted files, dashboards, and rule examples should be checked before they are used in production documentation or operations.

Example inputs to test

  • Architecture: client -> gateway -> api api -> database api -> queue
  • Service map: web: Web app api: API service db: Database web -> api -> db
  • Request relationships (not sequence): user -> app: request app -> api: fetch api -> app: response

Tool maturity

Basic parser

Basic parser

This tool focuses on fast structure inspection. Use it for review and debugging, then verify critical output before production use.

The maturity label is not a quality score. It tells visitors whether the tool is best for stable export, deeper debugging, quick parsing, or AI-assisted generation.