- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
Visualizers
Mermaid Class Diagram Editor
Sketch the classes of a program and how they relate, as UML from plain text.
- Runs in your browser
- Instant results
- Free, no sign-up
Loading the tool…
How to use the Mermaid Live Editor
- Declare classes with their fields and methods in braces, after "classDiagram".
- Mark visibility with + (public), - (private), # (protected), and connect classes with relationship arrows.
- Download SVG or PNG, copy the Markdown block, or copy a share link.
Frequently asked questions
How do I show inheritance in a Mermaid class diagram?
Write "Parent <|-- Child", for example "Animal <|-- Dog". The hollow triangle points at the parent class, as in UML.
What do + and - mean before a field?
Visibility. + is public, - is private, # is protected and ~ is package or internal. Methods end with parentheses and can show a return type after them, like "+getName() String".
What is the difference between composition and aggregation?
Composition (*--) means the part cannot live without the whole, like an engine in a car. Aggregation (o--) means the part can exist on its own, like a player in a team.
Can I draw interfaces and abstract classes?
Yes. Put a stereotype inside the class, such as "<<interface>>" or "<<abstract>>", and connect implementing classes with "..|>".
Syntax cheat sheet
| Code | What it does |
|---|---|
classDiagram | Start a class diagram |
class Dog { +String name +bark() void } | A class with a field and a method (one member per line) |
+ - # ~ | Public, private, protected, package visibility |
Animal <|-- Dog | Inheritance: Dog extends Animal |
Car *-- Engine | Composition: the engine is part of the car |
Team o-- Player | Aggregation: a team has players |
Order --> Customer | Association |
Shop "1" --> "*" Product | Multiplicity on a relationship |
<<interface>> Shape | A stereotype such as interface or abstract |
Practice Python with coding challenges
Solve hands-on problems right in this editor: run the sample tests, submit, and get an AI code review.