Markdown class diagram maker

Sketch a UML class diagram from text. List your classes, fields and relationships in Mermaid and get a clean diagram for an object model or API design.

Mermaid class syntax

A class diagram is a set of classes and the relationships between them. You name each class, list its attributes and methods, then draw a line for each relationship. Here is each piece you can write.

Classes and members

Declare a class and list its members inside braces. A + marks public, - private, # protected. A name with () is a method.

You write
classDiagram
  class Animal {
    +String name
    +move()
  }
You get

Relationships

Connect two classes with a relationship line. The style of line sets the kind.

You write
classDiagram
  Animal <|-- Dog
  Car *-- Engine
  Team o-- Player
  Order --> Product
You get

Labels

Add a colon and text after a relationship to name it.

You write
classDiagram
  Owner --> Dog : owns
You get

Cheat sheet

Write this You get
Members
+namePublic member
-namePrivate member
#nameProtected member
+run()A method
Relationships
A <|-- BB inherits A
A *-- BComposition
A o-- BAggregation
A --> BAssociation
A ..> BDependency
A -- BPlain link