How to use the UML Class Diagram Maker
- 1. Paste Python classesOr switch to the code tab and write Mermaid classDiagram code.
- 2. ConvertClasses, attributes, methods and relationships become a diagram.
- 3. DownloadSave as SVG for documents, or PNG for slides.
How Python becomes UML
- Each
class Name:becomes a box.class Student(Person):becomes an inheritance arrow, Person <|-- Student. self.name = …lines become attributes. Types come from hints (self.age: int), from typed __init__ parameters, or from simple values ("text" → str, 3 → int, [] → list).- Methods become operations with their parameters and return types from
->hints. - Visibility follows Python's naming habits:
nameis public (+),_nameis protected (#) and__nameis private (-). - An attribute typed as another class, like
courses: list[Course], becomes an association with multiplicity, 1 to many (*).
The code is only read, never run. Mermaid 10.9.0 draws the diagram in your browser with its strict security setting.
Worked example
The sample has 3 classes: Person, Course and Student. The diagram shows Student inheriting from Person, and a Student "1" --> "*" Course : courses association, because courses is typed as a list of Course. Person's _phone shows as protected (#), and Student's __total_fees() as private (-) with return type float.
Switch to Edit diagram code to adjust anything, such as adding a composition with *-- or an aggregation with o--, and the diagram redraws as you type. Mermaid code also renders directly in GitHub READMEs inside a ```mermaid block, so the diagram can live next to your code. For college projects and design documents, export SVG for crisp printing, or PNG at 2× size for slides.
The Python reader handles normal class code well. Classes built with decorators like @dataclass fields or metaclasses may need a small manual edit.
Frequently asked questions
Does it work with Java or C++ classes?
The automatic reader is for Python. For other languages, write the diagram in the Mermaid code tab, which uses simple class syntax.
Are dataclasses supported?
Class-level typed fields like name: str are read as attributes, so most dataclasses work.
Is my code uploaded?
No. It is read and drawn in your browser.
Do I have to pay for the uml class diagram maker?
No, it is free. Downloading your first diagram asks for your name and WhatsApp number one time only. Then the uml class diagram maker and all other Uncodemy tools stay open for you with no form.