UML Class Diagram Template
A UML class diagram shows the classes in a system, what data and behaviour each one has, and how they relate. This template has four classes for a small shop (Customer, Order, Product and PremiumCustomer) drawn as three-part boxes with a name, attributes and methods, joined by labelled association and inheritance arrows.
When to use a class diagram
Use it when you design object-oriented software, explain an existing codebase to a teammate, or teach classes and inheritance.
- Designing a new system before writing code
- Documenting classes and relationships
- Computer science lessons and exams
- Design reviews
What is in the template
Each class is a stack of three boxes: the class name on a blue header, the attributes with a minus sign for private, and the methods with a plus sign for public. Arrows show relationships: places and contains are associations with multiplicity (1..*), and the blue arrow with a triangle head from PremiumCustomer to Customer shows inheritance. The sample classes are an illustration. Replace them with your own.
How it works
Name your classes
Replace the headers with the main classes in your system. Start with the nouns in your requirements.
Add attributes and methods
Edit the two lower boxes of each class. Use a minus for private members and a plus for public ones.
Draw the relationships
Use association arrows for who uses whom, label them, and add multiplicity. Use the triangle arrow for inheritance.
Check and share
Walk through a use case along the arrows to see if anything is missing, then export an image for your documentation.
Frequently asked questions
Does it generate code?
No. It is a drawing board for design and teaching. It does not generate or read source code.
Is it a complete UML toolset?
No. It covers the common parts of a class diagram. For other diagram types see the sequence diagram and ER diagram templates.
Can I work on it with other people?
Yes. Start a live collaboration session from the editor and send the room link. Everyone with the link can edit the same board at the same time, and guests need no account.
How do I save or share the finished board?
Export it as a PNG or SVG image, or save it as an .excalidraw file that you can open again later and keep editing.
Related
- UML Class Diagram MakerMake a UML class diagram in your browser: class boxes with attributes and methods and arrows for relationships. Free, no account.
- ER Diagram TemplateA free entity relationship diagram template with customer, order, order item and product tables, keys and crow's foot relationships. Edit it online.
- Sequence Diagram TemplateA free sequence diagram template showing a login between user, web app, API server and database, with requests, replies and lifelines.
- System Architecture TemplateA free system architecture diagram template: clients, load balancer, API, database, cache, storage, queue and worker, with labelled connections.
- Basic Flowchart TemplateA free basic flowchart template with start and end, process steps, a yes/no decision, a loop and a shape legend. Edit and extend it online.