saovn

Uml Class Diagram

Drawing UML class diagrams by dragging boxes is slow. Here you describe the model in plain text — classes with their attributes and methods, then one line per relationship — and the diagram is drawn with proper UML notation. Edit the text and it redraws instantly; download SVG for documents or PNG for slides.

UML class diagram maker

UML Class Diagram Reference Pack

Printable UML class diagram reference: notation cheat sheet, relationship guide, multiplicity card, a class modelling worksheet and a design review checklist.

Formats: PDF, DOCX, XLSX. Instant download after payment (link valid 72 hours, up to 5 downloads). AI-assisted: the templates were drafted with AI help and reviewed and laid out by Kedop.

$3.00 USD, one-time

Secure card checkout by Stripe. Full refund within 7 days — see the refund policy and license.

Text syntax

WriteMeans
class Name { … }A class with attributes and methods on separate lines
abstract class NameAbstract class (name shown in italics)
interface NameInterface («interface»)
enum Name { RED GREEN }Enumeration
+name: TypePublic attribute (− private, # protected, ~ package)
+method(arg: Type): ReturnOperation — any line with brackets
A <|-- BB inherits from (generalises to) A
A <|.. BB implements interface A
A *-- BComposition: A owns B
A o-- BAggregation: A has B
A -- BAssociation
A --> BDirected association (navigable to B)
A ..> BDependency
A "1" -- "*" B : labelMultiplicities and a role label

The syntax is similar to popular text-based diagram tools, so a model written here is easy to move later.

UML relationship notation

RelationshipLineEnd markerExample
Generalisation (inheritance)SolidHollow triangle at the parentCardPayment is a Payment
RealisationDashedHollow triangle at the interfaceCardPayment implements Refundable
CompositionSolidFilled diamond at the wholeOrder is made of OrderLines; lines don’t exist without the order
AggregationSolidHollow diamond at the wholeOrder has a Payment that can exist separately
AssociationSolidNone (or open arrow for navigability)Customer places Orders
DependencyDashedOpen arrowA class uses another temporarily

Multiplicity

NotationMeaning
1Exactly one
0..1Zero or one
*Zero or more
1..*One or more
2..5Between two and five

Multiplicities are written at the end of the line next to the class they describe: in Customer "1" -- "*" Order, each order has exactly one customer and each customer has zero or more orders.

Worked example: an online shop

The sample model describes a small ordering system. A Customer places many Orders; each Order is composed of one or more OrderLines, each pointing to exactly one Product. Payment is abstract with a concrete CardPayment subclass, which also implements the Refundable interface, and an Order aggregates its Payment. The layout puts parents and wholes above their parts, so inheritance arrows point upward and composition diamonds sit at the top of each relationship.

Good class diagram habits

Reading the sample diagram

Start at the top: Customer and the abstract Payment class sit on the first row because nothing above them owns or generalises them. Order appears below Customer with the label “places” and multiplicities 1 and *, read as “one customer places many orders”. The filled diamond on Order’s end of the line to OrderLine says an order is composed of its lines; the hollow diamond toward Payment says an order has a payment that could exist independently. CardPayment points up to Payment with a hollow triangle (inheritance) and to Refundable with a dashed line and hollow triangle (it implements that interface).

Visibility and types

SymbolVisibilityTypical use
+PublicOperations other classes call
−PrivateInternal state such as IDs and caches
#ProtectedMembers for subclasses
~PackageMembers shared within a module

Types follow a colon (name: String) and operation return types follow the closing bracket (total(): Money). For early design sketches you can leave types out entirely; the diagram still draws.

Stereotypes and abstract classes

Guillemets such as «interface», «abstract» and «enumeration» are stereotypes — labels that extend UML’s basic vocabulary. Abstract class names are also shown in italics, as the diagram does for Payment. Teams sometimes add their own stereotypes like «entity» or «service» to show architectural roles; keep them consistent across diagrams.

From diagram to code

DiagramTypical code (Java-like)
class Order { -number: String }class Order { private String number; }
Payment <|-- CardPaymentclass CardPayment extends Payment
Refundable <|.. CardPaymentclass CardPayment implements Refundable
Order *-- OrderLineOrder holds a list of OrderLine objects it creates and destroys
Order o-- PaymentOrder refers to a Payment passed in from elsewhere
OrderLine --> ProductOrderLine has a field referencing a Product

Class diagrams describe structure rather than behaviour, so they map naturally onto classes, fields and method signatures in object-oriented languages. They are equally useful for designing database tables, where associations with multiplicities become foreign keys and link tables.

When to draw a class diagram

Limits of the automatic layout

The layout places classes in rows by their relationships and draws straight connectors, which keeps small and medium models (up to about 15–20 classes) readable. Very large or densely connected models may have crossing lines; splitting them into several diagrams usually helps more than manual placement. For full UML tooling — sequence diagrams, code generation, round-tripping — use a dedicated modelling tool.

Privacy

Your model is drawn entirely in your browser and never uploaded, so it’s safe for internal designs.

Frequently asked questions

How do I show inheritance in a UML class diagram?

A solid line with a hollow triangle pointing at the parent class; here, write Parent <|-- Child.

What is the difference between composition and aggregation?

In composition the part can’t exist without the whole (filled diamond); in aggregation it can (hollow diamond).

How do I show an interface?

Use «interface» and a dashed line with a hollow triangle for classes that implement it.

What do + and − mean?

Visibility: + public, − private, # protected, ~ package.

Can I export the diagram?

Yes, as SVG or PNG, or print it.

Is my model uploaded?

No. Everything stays in your browser.