Loading mermaid.tools…

Class diagram editor for interfaces and inheritance

Describe interfaces, classes, members, inheritance, composition, and dependencies in text that developers can review.

A class diagram explains structure and relationships in code. If you also need the order of calls between those objects, pair it with a sequence diagram.

How to make a class diagram online

  1. Declare each class, then add its fields and methods with a visibility marker so readers can see the public surface at a glance.
  2. Use the inheritance arrow for a subtype and the dotted implementation arrow for an interface, both pointing from the base type.
  3. Add composition or aggregation where one object owns another, rather than drawing every association as a plain line.
  4. Keep one collaboration per diagram; a class diagram that tries to cover a whole codebase stops being readable.
Mermaid class diagram: Class relationships. Edit this notification interface model in Mermaid, inspect the rendered result, and adapt the working source for your own documentation.
Class relationships — the starter this page opens with. See the full example.

Class diagram syntax cheat sheet

What it doesSyntaxNotes
StartclassDiagramSelects class diagram syntax.
Classclass NotificationDeclares a named class.
Public method+send()Adds a public operation.
Private field-String tokenAdds a private member.
InheritanceAnimal <|-- DogPoints from a base class to a subtype.
ImplementationChannel <|.. EmailA dotted arrow marks an interface implementation.

Editable class diagram examples

All class diagram examples · the whole example library

Frequently asked questions

Can a Mermaid class diagram show interfaces?

Yes. Add the interface annotation inside the class block and connect implementations with the dotted implementation arrow.

Can I include fields and methods?

Yes. Prefix each member with a visibility marker such as plus for public, minus for private, or hash for protected.

Is Mermaid source suitable for code review?

Yes. The diagram is plain text, so a change to it appears as a readable diff next to the code change that caused it.

Keep reading

Fix diagram errors · Export formats · all guides

mermaid.tools is an independent editor not affiliated with the Mermaid.js project or Mermaid Chart / mermaid.ai. Diagrams render in your browser with Mermaid 11.17.2.