How to draw a UML class diagram

Learn to draw a UML class diagram: what the boxes, lines and multiplicities mean, how to choose a relationship, and a permissions model worked through.

Written by
FlowDraw Team
Published
Reading time
7 min read
A FlowDraw board with a UML class diagram of a permissions model: Shareable, Resource, Board, Space, Workspace, Member, User and Role.

A UML class diagram shows the types in a system and how they relate. Learn the box and a few lines, and you can read most of them. To draw your own UML class diagram, you also need to know what to leave out.

Quick Answer

A UML class diagram shows classes as boxes with a name, attributes and methods, joined by lines for inheritance, association and ownership. To draw one, choose a narrow scope, name the classes, add only the members that matter, pick a relationship for each pair, then add multiplicities.

What is a UML class diagram?

It is the main structure diagram of UML, the modeling language maintained by the Object Management Group, whose specification is public. It shows what exists and how things connect, not what happens when.

A permissions model class diagram with pins on the Board class, the keyword on Role, an inheritance line and a multiplicity.
A small permissions model runs through this guide
  1. Class: a box for one type.
  2. Keyword: says what kind of box it is, here «enumeration».
  3. Line: how two classes relate.
  4. Multiplicity: how many on each end of a line.

Use it to agree on a design before coding, or to explain a module to a new teammate. For stored tables and foreign keys, an ER diagram is the better fit. For what happens over time, draw a sequence diagram.

The parts of a class

A class box has three compartments. From the top: the name, the attributes and the methods.

The Board class on its own: the name at the top, then title and elements, then duplicate() below a divider.
Name, attributes, methods

Each member can carry a visibility mark:

MarkVisibilityWho can use the member
+PublicAny class
-PrivateOnly this class
#ProtectedThis class and its subclasses
~PackageClasses in the same package

A keyword in guillemets changes what the box means:

The top row of the model: Shareable marked interface, Resource marked abstract, User with no keyword and Role marked enumeration.
Keywords sit above the class name
  • «interface» is a contract that other classes promise to meet.
  • «abstract» cannot be created directly, and its name is set in italics.
  • «enumeration» lists fixed values: OWNER, ADMIN, MEMBER.

UML class diagram relationships

RelationshipLineRead it asIn the example
AssociationSolid lineKnows about“Workspace” and “Member”
Directed associationSolid, open arrowKnows about, one way“Member” to “User”
InheritanceSolid, hollow triangle at the parentIs a kind of“Board” to “Resource”
RealizationDashed, hollow triangle at interfacePromises to do“Resource” to “Shareable”
DependencyDashed, open arrowUses“Member” to “Role”, marked «use»
AggregationSolid, hollow diamond at the wholeHas, part can live aloneNot used here
CompositionSolid, filled diamond at the wholeOwns, part goes with it“Board” in “Space”

Numbers at the ends of a line are multiplicities. 1 means exactly one, 0..1 means optional, 0..* or * means any number, and 1..* means at least one.

Board, Space and Workspace joined by filled diamonds, with 0..* at the part end and 1 at the whole end of each line.
A space holds 0..* boards, and a board sits in 1 space

Which line should I use?

Ask these in order and stop at the first yes:

  1. Is A a kind of B, in every situation? Use inheritance.
  2. Does A promise to meet the contract of interface B? Use realization.
  3. Does B exist only inside A, and go when A goes? Use composition.
  4. Does A keep a lasting reference to B? Use an association, with an arrow if only one side knows.
  5. Does A only touch B in passing, such as a parameter? Use a dependency.

Aggregation is missing on purpose. The UML specification leaves its exact meaning to the modeler, so many teams use a plain association instead.

How to draw a UML class diagram

Start with a question, not a codebase. The example answers one: who is allowed to do what to a board?

  • List the nouns in the question. Keep those with their own data or rules: “Board”, “Space”, “Workspace”, “Member”, “User”.

  • Look for what they share. “Board”, “Space” and “Workspace” all have an owner and can be shared, so they inherit from “Resource”.

    The model with Resource, Shareable and the inheritance and realization lines dark, and the other classes faded.
    What the classes share moves up to Resource
  • Add the members that explain the design. canEdit(user) is the point of this diagram. Getters and setters are not.

  • Draw the lines, strongest relationships first, using the questions above.

  • Add multiplicities and read each line aloud: “a workspace has one or more members”. If the sentence sounds wrong, so is the line.

    The model with the classes faded and the remaining lines dark: composition, association, directed association and dependency.
    The remaining lines, with their multiplicities

Build a class diagram in FlowDraw

The “UML class” template, dock tool and UML library come with Pro or Team. On Free they open a dialog with “Maybe later” and “Upgrade to Pro”.

On Free, you can still draw the same picture. Make each class a “Table” from “More tools”, with one column and three rows. “Ends” in “Line properties” offers “Hollow triangle”, “Diamond”, “Hollow diamond” and “Open arrow”, and “Dashed” sets the line style.

The FlowDraw Templates page showing the UML class card with a Pro badge, described as classes, interface and inheritance.
Find it under Templates in the sidebar
  1. Open the template

    On Home, click the “UML class” tile, or search for it under “Templates” and click “Use template”. To start blank, open a “Blank board” and click “UML class” in the dock. The UML section of “Shape library” adds “Abstract class”, “Enumeration”, “Package” and “Note”.

  2. Set the type

    Select a class. “Stereotype” in the side panel switches it between “Class”, “Abstract”, “Interface” and “Enum”.

  3. Add members

    Under “Attributes” and “Methods”, click “Add attribute” or “Add method”, then pick the visibility and type the name and type.

  4. Draw the relationships

    With nothing selected, press L and drag from one class to another: child to parent, part to whole. Select the line and pick from “Relationship” in “Line properties”. “Swap ends” flips a line drawn the wrong way around.

  5. Write the multiplicities

    “Add a label” writes to the middle of a line, so use the “Text” tool to place a small number beside each end. The end labels on the template’s own lines cannot be edited, so draw a new line where one needs to change.

The permissions model open in the FlowDraw editor, with the toolbar at the bottom and Share at the top right.
The template open in the editor

With AI, on Pro and Team, click “FlowDraw AI”, set “Diagram” to “UML class” and describe the model, or paste a few classes into the prompt:

UML class diagram of a permissions model. Board, Space and Workspace inherit from an abstract Resource that implements a Shareable interface. A workspace has members, and each member links to a user and has a role.

Check the arrow directions on the new board and add multiplicities where they matter.

Mistakes that make a class diagram misleading

  • Modeling the whole codebase. A diagram of every class answers nothing. Draw one question per diagram.
  • Inheritance to share code. If “is a kind of” sounds wrong out loud, use an association or composition.
  • Composition everywhere. Removing a member should not delete the user, which is why “Member” points at “User” with a plain arrow.
  • Marks at the wrong end. The triangle goes at the parent and the diamond goes at the whole.
  • Getters, setters and framework noise. They bury the members that matter.
  • No multiplicities. Whether a board sits in one space or many is often the very question.

Not on Pro yet? Start with a free account and try the table version.

FAQ

They show visibility. A plus is public, a minus is private, a hash is protected and a tilde is package. You can leave them out on an early sketch.

Continue Reading

A FlowDraw board with a Gantt chart for a website relaunch: 14 tasks in a table, bars across January to March 2027 and a red today line on Feb 18.

Guides·

How to make a Gantt chart

Learn how to make a Gantt chart: list the tasks, set dates and owners, link dependencies and track progress, then edit a free template in FlowDraw.

A FlowDraw board with a work breakdown structure for Customer conference 2027: five phases, each split into deliverables and numbered work packages.

Guides·

How to create a work breakdown structure

A work breakdown structure splits a project into phases, deliverables and work packages. Learn the 100% rule, how to size work and how to draw one.

A FlowDraw board with an engineering org chart: Alex Morgan at the top, then Lisa Carter, Mark Evans and Chris Walker with their reports.

Guides·

How to make an org chart

Make an org chart people can trust: what to collect, how to show reporting and dotted lines, and how to draw and share one for free in FlowDraw.

Ready to create your first diagram?

Turn your ideas, notes, or documents into a clear,
editable flowchart in seconds.

Get Started Free