DevTools Logo

Graphviz DOT Playground

Graphviz DOT Playground

Write DOT graphs, inspect the topology live and export SVG — all in your browser.

Runs in your browser
100%
0 nodes · 0 edges · 0 clusters
Try an example

DOT source

Graph preview

Write DOT to see a preview

Try an example to see how nodes, edges and attributes are parsed.

Details

Graphviz DOT Playground accepts standard DOT for directed and undirected graphs. It parses your source as you type, reports syntax problems with line numbers, counts nodes and edges, and draws a deterministic preview using a compact built-in layout. Switch between hierarchical and force-style engine presets to compare topology, then copy or download the preview SVG. Your DOT never leaves the tab.

More examples

Service dependencies

digraph services {
  rankdir=LR;
  api -> auth;
  api -> db;
  worker -> db;
}

A directed graph with a left-to-right hint. The preview shows four nodes and three directed edges.

State machine

digraph states {
  idle -> running [label=start];
  running -> paused [label=pause];
  paused -> idle [label=reset];
}

Edge labels are preserved by the parser and shown in the diagnostics summary.

Undirected cluster

graph network { subgraph cluster_a { a -- b } b -- c }

Undirected graphs use -- edges; the cluster subgraph is counted separately.

Examples

Service graph

Input
digraph { rankdir=LR; api -> auth; api -> db; worker -> db }
Output
4 nodes · 3 edges

A compact architecture graph with four nodes and three directed dependencies.

State machine

Input
digraph { idle -> running [label=start]; running -> paused [label=pause] }
Output
3 nodes · 2 labelled edges

Edge labels come from attribute brackets and are included in the parsed model.

Syntax error

Input
digraph {
  a ->
}
Output
Error on line 2: expected a node after the edge operator

The diagnostic points at the line where the broken statement begins.

About this tool

Graphviz DOT Playground is a browser workspace for writing standard DOT graph definitions. It parses directed and undirected graphs as you type, reports syntax problems with line numbers, counts nodes and edges, and draws a preview without installing Graphviz or uploading your source.

Choose a layout preset to compare a hierarchical arrangement with force-style circular layouts. Edge labels, quoted node names, attributes and cluster subgraphs are recognized, so the same DOT can be copied into a local Graphviz installation or a documentation build.

The built-in preview is a compact topology renderer, not a full port of Graphviz's layout engines. Use it to check syntax and structure quickly; use a native Graphviz binary when pixel-exact engine output is required. SVG output and DOT source can both be exported locally.

What this tool does not do

  • The preview uses a compact built-in layout rather than the native Graphviz layout engines.
  • Graphviz's wasm runtime, image attributes and font metrics are not bundled.
  • Share links are limited to graphs whose encoded payload is under 8 KB.
  • The parser covers common DOT constructs; exotic grammar may be reported as a diagnostic.

How to use this tool

  1. Write or paste DOT

    Start with digraph { a -> b } or pick an example chip to load a realistic graph.

  2. Pick a layout preset

    Choose a hierarchical or force-style engine preset to change how the preview arranges nodes.

  3. Fix diagnostics

    Errors show the line and message; the parser keeps previous counts until the source is valid.

  4. Export

    Copy or download the preview SVG, or generate a share link for graphs under 8 KB.

Use cases

Documentation diagrams

Draft architecture and state diagrams for READMEs, then export SVG without a local install.

Learning DOT

See how nodes, edges and attributes affect a graph while typing.

Syntax triage

Paste a graph from a build log to find the offending line before running the real binary.

Supported DOT forms

DOT syntaxHandled as
digraph { a -> b }directed edge
graph { a -- b }undirected edge
a -> b -> cedge chain
"quoted node" [label="Text"]quoted id with attributes
subgraph cluster_0 { … }cluster subgraph
//, # and /* */ commentsignored
rankdir, shape, style attributesparsed and preserved in the model

HTML-like labels are tokenized as a single label value; their inner markup is not rendered by the preview.

Common mistakes

Mistake:Using -> in an undirected graph.

Fix:Use -- for graph, or change the header to digraph.

Mistake:Expecting Graphviz-quality layouts from the browser preview.

Fix:Treat the preview as a topology check; run the real engine for final layouts.

Mistake:Forgetting to close a subgraph brace.

Fix:The parser reports an unclosed body with the last line number.

Mistake:Sharing a very large graph in a URL.

Fix:Export the DOT file instead; share links are capped at 8 KB.

Mistake:Using local image paths in labels.

Fix:Use data URIs when exporting to a standalone SVG.

Frequently asked questions

What is the difference between digraph and graph in DOT?

Use digraph with directed arrows (->) for state machines, call graphs, and dependencies, or graph with undirected edges (--) for symmetric network topologies.

When should I switch layout engines from dot?

dot arranges hierarchical top-down or left-right DAGs, neato/fdp use spring-force layouts for undirected networks, circo arranges cyclic rings, and twopi builds radial trees.

How do clusters and subgraphs work?

Naming a subgraph with the prefix cluster_ (for example subgraph cluster_api { ... }) draws a labeled bounding box around grouped nodes.

Can I export rendered diagrams without a backend?

Yes. Layout and SVG generation run locally in your browser and export directly as clean vector SVG.

References & standards