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
- 1Define your classes
Declare a class with its name, then list attributes and methods inside: class Animal { +int age +makeSound() }.
- 2Add inheritance and relationships
Use <|-- for inheritance (Animal <|-- Dog), *-- for composition, o-- for aggregation, and --> for association.
- 3Specify visibility
Prefix members with + (public), - (private), # (protected), or ~ (package). Add * after a method name to mark it abstract.
- 4Export 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.
Related Tools
More Developer Tools- Diff CheckerCompare two files for visual differences.Free • In browser
- SQL to ORM ConverterConvert CREATE TABLE SQL to Prisma, Drizzle, SQLAlchemy, Django, TypeORM, Sequelize, GORM, and Ecto model definitions — free, browser-based, no account needed.Free • In browser
- Hash GeneratorGenerate MD5, SHA-1, SHA-256, and SHA-512 hashes from text or files. Supports HMAC authentication codes.Free • In browser
Also useful: Markdown EditorSVG Converter