UML class diagram maker
MEMBERSClasses with attributes and operations, joined by inheritance, composition, aggregation and dependency, with a live Mermaid source.
Diagram
Diagram
Full stop and comma move between shapes, arrows move the selected one, Enter writes its text, C starts a connection, Delete removes. Capital R, D, O, B, T, N, F or S adds a shape. K folds, P shows what leads to the shape, Command or Control with F searches.
Pick a shape above and press here, or open a template.
Source, live both ways
Source, live both ways
What Mermaid can hold
What Mermaid can hold
What Mermaid cannot hold is kept in the project. Editing the code changes only what the code says.
Found a bug or missing something? Write to us
How it works
Reading and drawing class diagrams
The first line of a class is its name and the rest are its rows. A row of two hyphens draws the line between attributes and operations. Plus, minus and hash in front of a name say public, private and protected.
A hollow triangle points at the class that is inherited from. A full diamond is composition: the part does not live without the whole. A hollow diamond is aggregation, and a dashed arrow is a dependency.
Show only what the reader needs: a diagram with five classes and their relations explains more than one with fifty and every getter.
Help
FAQ
How does Mermaid tell attributes from methods?
A member with brackets, such as +pay() bool, is a method, with its return type after the brackets; anything else is an attribute. When code is read, rows with brackets go under the dividing line. A tilde marks package visibility, and $ or * after a member marks it static or abstract.
How is an interface or an abstract class marked?
With an annotation in double angle brackets, <<interface>> or <<abstract>>, written inside the class body or on a line of its own before the class name. Both forms are read, and the code writes the annotation as the first row inside the class.
How is the implementation of an interface drawn?
As a dashed line with a hollow triangle at the interface, written ..|> in Mermaid. In Colours and lines choose Hollow triangle for the end and Dashed for the line. The same dashed line with an arrow, ..>, is a dependency, and a solid one with an arrow, -->, an association.