Text & data

Graphviz Online

Write DOT code and watch the graph redraw as you type. Choose a layout engine, start from a template, then export SVG, PNG or a vector PDF, or share a link that carries the whole graph.

  • Graphs render locally in your browser. Nothing is uploaded to a server.
Drop or paste a .dot / .gv file onto the editor to open it.
Preview loading Graphviz… fit
Loading Graphviz (about 1.3 MB, cached after the first visit)…

How it works

1

Type DOT code on the left, open a .dot or .gv file, or pick a Template: directed graph, flowchart, state machine, dependency graph with clusters, linked list, org chart, network or class diagram.

2

The preview redraws a moment after you stop typing. Zoom with the buttons, Ctrl/⌘ + scroll or a two-finger pinch, and drag the preview to pan.

3

Choose a layout engine, then copy SVG, download SVG, download PNG at 1× to 4×, download PDF or download .dot.

Graphviz is the classic graph visualisation toolkit. You describe nodes and edges in the DOT language (a -> b) and Graphviz works out the positions, so diagrams stay readable as they grow and live happily in a git repository. This page runs the real Graphviz layout code, compiled to WebAssembly, in a background worker, so even a heavy graph cannot freeze the page.

DOT language cheat sheet

You wantDOT
Directed graph, arrowsdigraph G { a -> b }
Undirected graph, plain linesgraph G { a -- b }
Chain and fan outa -> b -> c; a -> {d e f}
Label and colour a nodea [label="Start", color=blue, style=filled, fillcolor=lightblue]
Shapebox, ellipse, circle, doublecircle, diamond, parallelogram, hexagon, cylinder, note, plaintext, point
Rounded boxnode [shape=box, style=rounded]
Defaults for all nodes or edgesnode [shape=box]; edge [color=gray];
Edge label, style, arrowa -> b [label="yes", style=dashed, arrowhead=vee]
Directionrankdir=LR (left to right), TB (default), RL, BT
Group in a boxsubgraph cluster_a { label="Group"; x; y }
Same row or column{ rank=same; a; b }
Record noden [shape=record, label="{ name | age | <p> port }"]
HTML-like labeln [shape=plain, label=<<table><tr><td><b>Hi</b></td></tr></table>>]
Fontfontname="Helvetica"
Coloursnames (tomato), hex ("#4a6fa5"), or with alpha ("#4a6fa580")
Stylesfilled, dashed, dotted, bold, rounded, invis, combined as style="rounded,filled"
Comment// line, /* block */, # line

Quote any name that contains spaces or punctuation: "Load balancer" -> "App server". Statements end with a semicolon or a line break, and the last attribute in a list needs no comma.

Which layout engine to use

EngineBest for
dotHierarchies, flowcharts, dependency graphs and anything with a direction. The default.
neatoSmall to medium undirected networks, laid out like a spring model.
fdpUndirected graphs, like neato but with better support for clusters.
sfdpLarge graphs with hundreds or thousands of nodes. The fastest engine.
circoCircular layouts, good for cyclic structures and ring networks.
twopiRadial layouts with one root in the centre. Set root=name to choose it.
osageClustered graphs packed into a grid of nested boxes.
patchworkTreemaps where cluster area follows the area attribute.

DOT or Mermaid?

Pick DOT when you need control over layout and styling, very large graphs, clusters, record and HTML-table nodes, or a layout other than top-down. Pick Mermaid when you want the shortest syntax for common diagram types such as sequence diagrams, Gantt charts and ER diagrams, or when your Markdown host renders it natively. For simple flowcharts either works; try the Flowchart Maker for the Mermaid way.

SVG, PNG or PDF?

SVG stays sharp at any size and can be edited later in Figma, Inkscape or Illustrator. PNG pastes anywhere; it is drawn at the graph's natural size times the scale you pick, on a white, dark or transparent background. PDF is a true vector page sized to the graph, good for print and papers. Very large graphs may exceed what a browser can draw as PNG; use SVG or PDF for those.

Privacy and sharing

Layout and export all happen on your device and nothing is sent to a server. Share link compresses your DOT code with lz-string and places it, with the chosen engine, in the URL fragment, the part after #. Browsers never send the fragment to any server, so the graph exists only inside the link. Your draft is kept in this browser's local storage so a refresh doesn't lose your work.

Frequently asked questions

Frequently asked questions

Is my graph uploaded to a server?

No. Graphviz is compiled to WebAssembly and runs in a background worker inside this page, so layout and export happen on your device. Your draft is kept in this browser's local storage so a refresh doesn't lose it.

How do I convert DOT to SVG or PNG?

Paste your DOT code into the editor, then use download SVG, or pick a PNG scale from 1× to 4× and a background and use download PNG. There is also a vector PDF export and a button that saves the .dot source.

Which layout engine should I use?

Use dot for hierarchies, flowcharts and anything with a direction. Use neato or fdp for undirected networks, sfdp for very large graphs, circo for cyclic structures, twopi for radial trees, osage for clustered grids and patchwork for treemaps.

Why does the editor say the layout took too long?

Some layouts, such as dot on thousands of densely connected nodes, can take minutes. If a render runs longer than about eight seconds it is stopped so the page stays responsive. Try sfdp, which is built for large graphs, or simplify the graph.

Does this match the Graphviz command line?

It uses the real Graphviz layout code compiled to WebAssembly, so the layout is the same. The one difference is text measurement: without system fonts, label sizes are estimated from standard font metrics, so nodes can differ by a few pixels from a desktop render.

Related tools