Write classes with indented members and relationships named in words, and get a Mermaid class diagram with generics rewritten to parse.
Describe your class diagram
A few lines of text. Nothing is uploaded and no diagram library is loaded.
class Name on its own line, with its members indented beneath it. A member’s first character sets visibility — + public, - private, # protected, ~ package — and a name ending in () is a method. Add <<interface>> after a class name for a stereotype. Relationships name their kind: Order -- owns --> LineItem : contains, where the word may be extends, owns, has, knows, uses or implements. A plain --> is a loose association. A comment needs a space after the hash, since # alone means protected.Write a few lines on the left to get Mermaid that renders.
Generic types are rewritten from List<Order> to the tilde form Mermaid parses, because the angle-bracket form stops the diagram rendering. Kinds are taken from the word you wrote and not guessed from the names, since the difference between composition and aggregation is a claim about lifetimes that only you know. This describes a model; it does not read your code, so nothing here is checked against an actual class.
Nothing is drawn on this page and no diagram library is loaded — the output is text, which is what survives being pasted anywhere. GitHub, GitLab, Notion and most documentation site generators render Mermaid from a fenced ```mermaid block directly, so the diagram appears where it is committed rather than here.
Mermaid Class Diagram Generator runs entirely on your device — the diagram is generated in your browser and nothing you describe is uploaded.
You’re on the Free plan. Compare plans
Relationships are named in words — owns, has, uses, extends, implements — rather than drawn with Mermaid's arrow glyphs, because nobody remembers whether a filled or hollow diamond is composition, and the two make opposite claims about ownership. A filled diamond says the part cannot outlive the whole; a hollow one says it can. Pick the wrong glyph and the diagram asserts a lifecycle rule the code does not have, which is worse than no diagram because somebody will design against it.
Generics are the other trap. A member typed List<Order> breaks Mermaid's parse, so the generator rewrites the angle brackets to the tilde form Mermaid expects — which is also why a class diagram transcribed by hand from a real codebase usually fails on the first attempt.
Members are written with the visibility symbol they will have in the output, and a name ending in parentheses is a method. What is written matches what is drawn, so the notation stays checkable against the generated text rather than translating silently.
Because the glyphs are easy to confuse and the mistake inverts the meaning. Composition says the part dies with the whole; aggregation says it does not. A diagram that claims the wrong one is a design document asserting something untrue.
The angle brackets are rewritten to Mermaid's tilde form, which is what it parses. Written literally, List<Order> inside a class body stops the whole diagram rendering.
By a trailing pair of parentheses on the name, which is the same rule the output uses. Writing total() gives a method; writing total gives a field.
Because a bare hash is the protected-visibility symbol. Without the space rule, every protected member would be silently eaten as a comment — which is exactly the bug that rule exists to prevent.
No. It describes a model you write, and nothing here is checked against an actual class. The JSON to model and SQL schema to ORM tools on this site generate from real inputs.
If a tool here saved you some time, you can put something towards the hosting.Buy me a coffee, on Ko-fi, opens in a new tab