Mermaid Class Diagram Editor

Design UML class diagrams with inheritance, interfaces, and relationships using Mermaid syntax — live preview, free.

Runs 100% in your browser. Your input and files never leave your device.

Why use our online Mermaid Class Diagram Editor?

Design UML class diagrams with inheritance, composition, and interfaces in Mermaid syntax — with live preview and instant export.

How to use Mermaid Class Diagram Editor

  1. 1
    Define your classes

    Declare a class with its name, then list attributes and methods inside: class Animal { +int age +makeSound() }.

  2. 2
    Add inheritance and relationships

    Use <|-- for inheritance (Animal <|-- Dog), *-- for composition, o-- for aggregation, and --> for association.

  3. 3
    Specify visibility

    Prefix members with + (public), - (private), # (protected), or ~ (package). Add * after a method name to mark it abstract.

  4. 4
    Export the diagram

    Download as SVG for vector-quality output, or PNG at 2× for embedding in documentation and presentations.

Frequently Asked Questions

How do I show inheritance in a Mermaid class diagram?

Use the <|-- notation: Animal <|-- Dog. The arrow points from the subclass to the superclass, matching UML convention.

What is the difference between composition and aggregation in Mermaid?

Composition (*--) means the child cannot exist without the parent. Aggregation (o--) means the child can exist independently. Both are shown as different arrow types.

How do I add an interface in a Mermaid class diagram?

Use the <<interface>> annotation: class IAnimal { <<interface>> +makeSound() }. Similarly, use <<abstract>>, <<enumeration>>, or <<service>>.

Can I add methods with return types?

Yes. Define methods with type annotations: +String getName() or -int calculateArea(float radius). Place the return type after the closing parenthesis.

What is the difference between a class diagram and an ER diagram?

Class diagrams model object-oriented code — classes, methods, and inheritance. ER diagrams model database schemas — tables, columns, and foreign key relationships.

Also useful: Markdown EditorSVG Converter