Diagrams / Mermaid Sankey Diagram: Syntax & Examples

Mermaid Sankey Diagram: Syntax & Examples

Create a Mermaid Sankey diagram from source, destination and quantity rows. Check units and totals with an editable flow example before exporting.

When to use Sankey Diagram

Use a Mermaid Sankey diagram to show quantities moving between categories. Flow widths help readers see how an amount splits or combines. Define one unit throughout the diagram and distinguish actual transfers from correlations or simple relationships.

Read the Sankey Diagram example

Diagram source

sankey-beta
Input,Useful work,70
Input,Heat loss,20
Input,Other loss,10
The example distributes an energy input to useful work and losses. The flows use the same unit and the totals balance. These are illustrative values, not a measurement of a specific machine.

Syntax and interpretation

ConceptHow to apply it
RowsEach row supplies a source, destination, and numeric quantity. Keep node names consistent across rows.
AccountingCheck totals at intermediate nodes. An unexplained mismatch can mislead readers about conservation or missing categories.
ScopeAvoid too many small flows. A detailed accounting table can accompany a simpler diagram.

Common questions

Is a Sankey appropriate for ordinary dependencies?

Usually not. Sankey widths imply quantities. Use a flowchart or architecture diagram when relationships have no meaningful amount attached.