Developer and Text Tools

How to Draw a UML Class Diagram That Developers Can Actually Read

A practical guide to classes, interfaces, enums, the six UML relations and multiplicity, plus tips on layout and exporting to PlantUML and Mermaid.

Saizul Amin
Saizul Amin7 Nov 2026 · 4 min read
How to Draw a UML Class Diagram That Developers Can Actually Read

Class diagrams have a reputation for being the thing you draw for an exam and never again. Used well, though, a small class diagram is one of the fastest ways to agree on a design before anyone writes code, or to explain an existing module to a new team member. The trick is to keep it small and to get the notation right, so that every arrow means one thing.

Start with the boxes

Each box in a class diagram is a type. A plain class has its name in bold. An abstract class, one you never create directly, has its name in italics. An interface is marked with the stereotype interface written in guillemets above the name, and an enumeration is marked with enumeration and lists its values instead of fields.

Below the name come two compartments: attributes, the data each object holds, and operations, the methods it offers. Write each member with a visibility mark in front. A plus means public, a minus private, a hash protected and a tilde package-level. Add the type after a colon, as in - email: String or + total(): Money. Static members are underlined and abstract operations are set in italics.

Resist the urge to list every getter and setter. A class diagram is a map, not a copy of the code. Show the fields and methods that explain what the class is for.

Learn the six arrows

Most confusion in class diagrams comes from the lines between boxes. There are six that matter.

Inheritance is a solid line ending in a hollow triangle at the parent. Use it when one class extends another. Realization looks the same but dashed, and means a class implements an interface. Composition is a solid line with a filled diamond at the whole: the parts belong to it and disappear with it, like order lines inside an order. Aggregation has a hollow diamond and means the whole holds parts that can exist on their own, like players in a team. Association is a plain line, often with an open arrowhead, for a lasting link between objects. Dependency is a dashed arrow for a looser "uses" relation, such as a method that takes another class as a parameter.

Add multiplicity and labels

Numbers at the ends of a line say how many objects take part. A customer places zero or more orders, written 1 at the customer end and 0..* at the order end. An order has one or more lines, 1..*. Optional is 0..1. A short verb in the middle of the line, such as places or uses, makes the diagram read like a sentence.

Drawing it in the browser

The free UML Class Diagram Editor gives you a canvas where you can add classes, abstract classes, interfaces and enums with one tap, drag them into place with a mouse or a finger, and type members one per line. Select a box to edit its name, kind, stereotype, colour and members. In the Relations tab you choose the two boxes and the relation type, then fill in the multiplicities and a label. Every change can be undone, and the diagram is saved in your browser.

The built-in sample is a small online shop: Customer, Order, OrderLine, an abstract Product with two subclasses, a PaymentMethod interface with a card implementation, and an OrderStatus enum. Its eight relations use every arrow type, so it is a good reference while you learn the notation.

Let the layout help

When the boxes pile up, press Auto layout. Parents and wholes go above their children and parts, and each row is reordered to reduce crossing lines. Then nudge a few boxes by hand or with the arrow keys until the diagram reads cleanly from top to bottom.

The Checks tab catches common mistakes: two boxes with the same name, a method written without parentheses, a relation pointing at a deleted box, an inheritance cycle, or a class that extends an interface when it should implement it.

Export to where your team works

Download the diagram as SVG for documentation, as a double-resolution PNG for slides, or print it to PDF. If your team keeps diagrams as code, copy the PlantUML or Mermaid text. The PlantUML export follows PlantUML's own conventions, with the parent on the left of an inheritance arrow and multiplicities in quotes, and the importer reads PlantUML class diagrams back in, so you can move between the editor and a text file in a repository.

Keep diagrams honest

A class diagram drifts out of date the moment the code changes. Keep each one focused on a single question, such as how payments plug into orders, date it, and redraw it when the design changes. A diagram of eight boxes that is right is worth far more than one of eighty that is wrong.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages