Diagram Creator
Write Mermaid syntax and get a live diagram you can zoom, pan and export as SVG or PNG.
Flowchart — header & node shapes
flowchart TDHeader — top to bottom (also LR, BT, RL)A[Box]Rectangle — a process stepA(Rounded)Rounded rectangleA([Stadium])Stadium — start or endA{Decision}Diamond — a branchA[(Database)]Cylinder — storageA((Circle))Circle — a junctionA[/Input/]Parallelogram — input or outputA[[Subroutine]]Framed box — a sub-processFlowchart — links between nodes
A --> BArrowA --- BPlain line, no arrowheadA -.-> BDotted arrowA ==> BThick arrowA -->|label| BArrow with a labelA -- text --> BArrow with a label (alt syntax)A & B --> CTwo sources into one targetA ----> BLonger arrow — pushes B further awayFlowchart — grouping & styling
subgraph Name … endGroup nodes into a labelled boxclassDef warn fill:#feeDefine a reusable node styleclass A,B warnApply a style class to nodesA:::warnApply a style class inlinestyle A stroke-width:3pxStyle one node directlySwimlane
swimlane-betaHeader line — the bare swimlane is not a diagram typeswimlane-beta LRLanes as rows, flow left to right (TD makes them columns)subgraph Customer … endEach subgraph is one lane, labelled by its nameA([Order]) --> B[Pay]Inside a lane — every flowchart shape worksB --> CAcross lanes — links may cross freelyA -->|label| BLabelled links, as in a flowchartclassDef warn fill:#feeStyling works too (apply with A:::warn)Sequence — participants & messages
sequenceDiagramHeader lineparticipant A as AliceDeclare a participant with a display nameactor BParticipant drawn as a stick figureA->>B: textSolid arrow — a callA-->>B: textDashed arrow — a replyA->B: textSolid line, no arrowheadA-xB: textCross — a lost messageA-)B: textOpen arrow — async, no reply expectedA->>A: textSelf-message — a loop back to itselfautonumberNumber every messageSequence — structure & notes
alt … else … endAlternative pathsopt … endOptional pathloop label … endRepeated sectionpar … and … endParallel actionscritical … option … endCritical section with fallbacksbreak … endStops the flow earlyactivate AStart an activation bar (deactivate ends it)A->>+B: textActivate on send, - deactivates on replyNote over A,B: textNote spanning participantsNote right of A: textNote beside one (also left of)box Name … endGroup participants into a labelled boxrect rgb(230,230,240)…endColoured band behind a sectionState machine
stateDiagram-v2Header line[*] --> IdleStart state (and Idle --> [*] to end)Idle --> Busy: startTransition with a trigger labelstate "Long name" as sGive a state a readable labelIdle : descriptionAdd a line of description to a statestate A { … }Composite state with its own inner machinestate c <<choice>>Decision pointstate f <<fork>>Split into parallel paths (<<join>> rejoins)--Divides concurrent regions inside a compositenote right of Idle : textAttach a notedirection LRLay the machine out left to rightclassDef warn fill:#feeStyle states (apply with class A warn)User journey
journeyHeader linetitle Buying a ticketJourney titlesection SearchGroup the steps into a stageOpen the site: 5: MeTask, satisfaction 1–5, then who did itEnter card: 2: Me, BankSeveral actors, comma separatedGit graph
gitGraphHeader linecommitA commit on the current branchcommit id: "first"Commit with a labelcommit tag: "v1.0"Commit carrying a tagcommit type: HIGHLIGHTAlso REVERSE and NORMALbranch devCreate a branch (and switch to it)checkout mainSwitch branchesmerge devMerge a branch into the current onecherry-pick id: "b"Copy one commit acrossClass — members
classDiagramHeader lineclass Account { … }Declare a class and its members+publicPublic member-privatePrivate member#protectedProtected member~packagePackage / internal member+total() MoneyMethod with a return type<<interface>>Annotation inside the class bodyClass — relationships
A <|-- BInheritance — B is an AA *-- BComposition — B cannot outlive AA o-- BAggregation — A holds B, looselyA --> BAssociationA ..> BDependency — A uses BA ..|> BRealisation — A implements BA "1" --> "*" B : labelCardinality on each end, plus a labelnote for A "text"Attach a note to a classdirection LRLay the diagram out left to rightclassDef warn fill:#feeStyle classes (apply with A:::warn)Entity relationship
erDiagramHeader lineA ||--o{ B : placesRelationship, read left to right||Exactly oneo|Zero or one}|One or moreo{Zero or moreA ||..o{ B : xDashed — a non-identifying relationshipUSER { int id PK }Attribute block; also FK and UKstring email "unique"Attribute with a commentp[Person] { … }Entity with a display aliasBlock
block-betaHeader linecolumns 3How many blocks fit per rowa["Label"]Block with a labela["Wide"]:3Block spanning three columnsspaceLeave one cell empty (space:2 for more)block:group … endNest blocks inside a groupa --> bArrow between blocksa -- "then" --> bLabelled arrowa(("Circle"))Shapes work as in flowchartsArchitecture
architecture-betaHeader linegroup api(cloud)[API]A boundary with an icon and a labelservice db(database)[DB]A componentservice s(server)[S] in apiPlace a component inside a groupa:R -- L:bEdge from a's right to b's lefta:R --> L:bSame, with an arrowheadjunction jA joint where edges meet(cloud)Icon names: cloud, database, disk, server, internetC4 context
C4ContextHeader (also C4Container, C4Component)Person(id, "Name", "desc")A human actorSystem(id, "Name", "desc")A system you ownSystem_Ext(id, …)A system someone else ownsSystemDb(id, …)A datastoreContainer(id, "Name", "Tech")A deployable unit (C4Container)Enterprise_Boundary(id, …)Draw a boundary around others — { } holds themRel(a, b, "uses")A relationship (BiRel for both ways)Packet
packet-betaHeader linetitle A frameOptional title0-15: "Source port"A field spanning bits 0 to 1516: "Flag"A single-bit field0-7 then 8-15Ranges must run in order, with no gapsGantt
ganttHeader linedateFormat YYYY-MM-DDHow the dates below are writtenaxisFormat %d %bHow the axis prints themsection BuildGroup tasks into a bandSpec :a1, 2026-01-05, 5dTask — id, start, durationQA :after a1, 3dStart when another task finishes:done,Also active, and crit, before the id:milestone, m1, …, 0dA zero-length markerexcludes weekendsSkip non-working daystodayMarker offHide the "today" lineTimeline
timelineHeader linetitle HistoryOptional title2020 : StartedA period and what happened in it2020 : One : TwoSeveral events in the same periodsection EarlyGroup periods into an eraKanban
kanbanHeader lineTodoA column — anything at the outer indent[Write the spec]A card, indented under its column@{ assigned: 'sam' }Metadata after the card@{ priority: 'High' }Very High / High / Low / Very Low@{ ticket: 'AB-1' }Show a ticket reference on the cardRequirement
requirementDiagramHeader linerequirement name { … }A requirement blockid: 1Required inside the block, with text:risk: highlow / medium / highverifymethod: testanalysis / inspection / test / demonstrationfunctionalRequirementAlso interface, performance, physical, designConstraintelement name { type: app }Something that implements a requiremente - satisfies -> rAlso traces, contains, derives, verifies, refines, copiesQuadrant
quadrantChartHeader linetitle Effort vs impactOptional titlex-axis Low --> HighLabels for each end of the x axisy-axis Small --> BigSame for the y axisquadrant-1 Do nextTop right; 2 top left, 3 bottom left, 4 bottom rightThing: [0.2, 0.8]A point — both values run 0 to 1Mind map
mindmapHeader linerootIndentation alone makes the hierarchyroot((Middle))Circle — the usual root shapeid[Square]Square nodeid(Rounded)Rounded nodeid))Bang((Bangid)Cloud(Cloudid{{Hexagon}}HexagonPie chart
pieHeader linepie showDataPrint each value next to its labeltitle Traffic by sourceOptional title"Direct" : 271A slice — the label must be quotedXY chart
xychart-betaHeader linetitle "Monthly signups"Optional title — quotedx-axis [jan, feb, mar]Categories along the bottomx-axis "t" 0 --> 5Or a numeric rangey-axis "Signups" 0 --> 900Label and rangebar [220, 310, 285]A bar seriesline [220, 310, 285]A line series — both can share a chartSankey
sankey-betaHeader lineVisits,Signups,4200Plain CSV: source, target, amount"A, inc",B,10Quote a label that contains a commaRadar
radar-betaHeader linetitle Team skillsOptional titleaxis a["Code"], b["Ops"]The spokes; repeat the line for morecurve x["Now"]{80, 55}One value per axis, in ordermax 100Outer edge of the scale (min for the centre)graticule polygonGrid shape — polygon or circleticks 4How many rings to drawTreemap
treemap-betaHeader line"Root"A branch — quoted, indentation makes the nesting"Leaf": 10A leaf and its size"A": 5:::bigApply a style class to one nodeclassDef big fill:#feeDefine that style classEvery diagram
%% a noteComment line — never rendered---
title: My diagram
---Front matter above the header lineconfig:
look: handDrawnIn front matter — a sketched look%%{init: {"theme": "forest"}}%%Override the theme for this diagram onlyExamples — click to load
Branching with {…} diamonds, labelled arrows, and a loop back to an earlier step.
Every common shape in one left-to-right chain — a visual cheat sheet.
Groups nodes with subgraph … end and colours the storage nodes with classDef.
One subgraph per role becomes one lane; links cross lanes to show each handover. Everything else is flowchart syntax — shapes, labelled branches and classDef all work.
Activation bars with +/-, dashed replies, an alt/else branch and a note.
loop, parallel par/and, a break path, async -) sends and a lost -x message.
[*] marks the start and end states; text after : labels the transition.
A nested machine inside state … { }, a <<choice>> branch point and a note.
Crow-foot markers give the cardinality: || exactly one, o{ zero or more, |{ one or more. Keys are PK, FK, UK.
An <<interface>>, realisation with <|.., aggregation o--, a dependency ..> and a note.
Each task scores satisfaction 1–5; the actors after the score share the step.
A hotfix merged to main and cherry-picked onto a release branch, then tagged.
A fixed columns grid with spans, a nested block: group, space and a labelled arrow.
Services placed in groups, with edges anchored to sides — L, R, T, B.
People, an owned system and an external one inside an Enterprise_Boundary, joined by Rel and BiRel.
Bit ranges laid out in order with no gaps — that ordering is what the parser requires.
Chained after dependencies, done/active/crit states, a milestone and excludes weekends.
Periods grouped into section eras; extra : segments add more events to the same year.
Cards carry @{ } metadata — assignee, ticket and priority all render on the card.
Two requirement kinds, an element that implements them, and satisfies/verifies/derives links.
Both point values run 0 to 1; quadrant-1 is the top right, then anticlockwise.
Indentation alone builds the tree; the shape brackets change how a branch is drawn.
showData prints the raw values; slices are shares of the total, whatever it adds up to.
Two series on one chart — both read the same y-axis range, so keep their scales comparable.
Plain CSV — source,target,amount. Nodes appear from the names; nothing is declared.
Two curves over the same axes — values are listed in axis order, so both must have the same count.
Indentation nests the branches; only leaves carry a value, and the branches sum them.