Graphviz DOT Playground
Write DOT graphs, inspect the topology live and export SVG — all in your browser.
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
digraph { rankdir=LR; api -> auth; api -> db; worker -> db }4 nodes · 3 edgesA compact architecture graph with four nodes and three directed dependencies.
State machine
digraph { idle -> running [label=start]; running -> paused [label=pause] }3 nodes · 2 labelled edgesEdge labels come from attribute brackets and are included in the parsed model.
Syntax error
digraph {
a ->
}Error on line 2: expected a node after the edge operatorThe 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
Write or paste DOT
Start with digraph { a -> b } or pick an example chip to load a realistic graph.
Pick a layout preset
Choose a hierarchical or force-style engine preset to change how the preview arranges nodes.
Fix diagnostics
Errors show the line and message; the parser keeps previous counts until the source is valid.
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 syntax | Handled as |
|---|---|
| digraph { a -> b } | directed edge |
| graph { a -- b } | undirected edge |
| a -> b -> c | edge chain |
| "quoted node" [label="Text"] | quoted id with attributes |
| subgraph cluster_0 { … } | cluster subgraph |
| //, # and /* */ comments | ignored |
| rankdir, shape, style attributes | parsed 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
Related tools
AssemblyScript Playground
Write AssemblyScript-style functions, inspect a module preview, and run exports with a step-bounded offline evaluator.
Bash Playground
Test bash script snippets in a local mini-shell with seeded files, stdin, stream tags and visible sandbox limits.
C & C++ Playground
Check C and small C++ source for structural problems, map findings to lines and see the compile command for a local toolchain.
C# Playground & Snippet Checker
Static pre-flight checks for C# snippets — diagnostics, detected features and metrics, entirely in-browser.
Dart Playground
Write Dart, press Run, and see print output in your browser.
DBML Playground
Write DBML and see an ER diagram plus SQL DDL for Postgres, MySQL, SQLite and MSSQL, all in your browser.