About this guide: This is an independent community resource for Dia users. We are not affiliated with the GNOME project or the Dia developers. Dia is free, open-source software released under the GNU GPL.
Dia is one of the most practical free tools for drawing UML class diagrams. It is lightweight, works fully offline, and its dedicated UML sheet covers the symbols you actually need: classes, interfaces, associations, aggregation, composition, and generalization. If you are documenting a codebase, preparing a software design document, or studying UML for a course, this step-by-step tutorial shows you exactly how to build a clean class diagram in Dia — no prior experience required.
Before you start, make sure Dia is installed. If you have not installed it yet, see our Dia download page or the Windows installation guide.
Step 1: Open Dia and Select the UML Sheet
Launch Dia. You will see two windows: the Toolbox (with drawing tools) and an empty canvas. (Tip: starting Dia with the --integrated option merges them into a single window.)
- In the Toolbox, find the drop-down menu at the top that lists shape collections (“sheets”). It may currently say “Assorted” or “Flowchart”.
- Click the drop-down and select UML.
- The Toolbox now shows UML objects: Class, Interface, Association, Aggregation, Composition, Generalization, Dependency, Realization, Note, and others.
Step 2: Place Your First Class
- Click the Class tool in the Toolbox.
- Click anywhere on the canvas. A class box with three compartments appears: name, attributes, and operations.
- Double-click the class to open its Properties dialog.
- In the Class tab, type the class name (e.g.
Customer). Check Abstract if the class is abstract — Dia will render the name in italics, per UML convention. - Click OK.
Step 3: Add Attributes and Operations
With the class selected, double-click it again to reopen Properties:
- Go to the Attributes tab and click New. Enter the attribute name (e.g.
email), its type (e.g.String), and its visibility (see the table below). - Go to the Operations tab and click New to add methods (e.g.
placeOrder()), with parameters and return types. - Use the Up/Down buttons to order attributes and operations sensibly.
Visibility symbols in Dia
| Symbol | Meaning | Dia setting |
|---|---|---|
+ |
Public | Visibility: Public |
- |
Private | Visibility: Private |
# |
Protected | Visibility: Protected |
~ |
Package | Visibility: Package |
Step 4: Connect Classes with Relationships
The UML sheet provides a separate tool for each relationship type — pick the right one from the Toolbox instead of drawing plain lines:
| Toolbox tool | UML meaning | Visual | Example |
|---|---|---|---|
| Association | A uses / knows B | Plain line | Customer — Order |
| Aggregation | Weak “has-a” (shared) | Hollow diamond | Team ◇— Player |
| Composition | Strong “has-a” (owned) | Filled diamond | House ◆— Room |
| Generalization | Inheritance | Hollow triangle | Dog —▷ Animal |
| Dependency | Uses temporarily | Dashed line | Report – -> Printer |
| Realization | Implements interface | Dashed + hollow triangle | Class – -▷ Interface |
- Select the relationship tool, then click the first class — small crosses appear. These are connection points.
- Click a connection point on the first class, then a connection point on the second class. The line snaps and stays glued: move either class and the connector follows.
- Double-click the connector to set its name, multiplicity (e.g.
1..*), and role labels.
Step 5: Add Interfaces (Lollipop Notation)
- Select the Interface tool and click the canvas — Dia draws the lollipop (circle on a stick).
- Double-click it to name the interface (e.g.
Payable). - Connect implementing classes with the Realization tool, or draw the lollipop directly attached to the class edge.
Step 6: Annotate with Notes
Use the Note tool (the dog-eared rectangle) for explanations, constraints, or TODO markers. Connect a note to a class with a dashed line to show what the comment refers to. Notes do not affect the UML semantics — they are documentation for humans.
Step 7: Tidy the Layout
- Snap to grid: enable View > Show Grid and View > Snap to Grid to align boxes neatly.
- Zoom: use View > Zoom or Ctrl + mouse wheel. Work at 100–150% for precise placement.
- Layers: for large diagrams, open View > Layers (F3) and put background annotations on a separate layer you can hide.
- Consistent sizing: keep class boxes roughly the same width; Dia does not auto-resize, so eyeball it with the grid.
Step 8: Save and Export
- Save your work with File > Save as a
.diafile (Dia’s editable format — always keep this). - For sharing, use File > Export: SVG for crisp scaling in documents and web pages, PNG for slides and chat, PDF for print.
See our detailed guide: How to Export High-Quality Images from Dia.
Worked Example: A Small Library System
Theory sticks better with a concrete example. Let’s model a tiny library system with four classes — follow along in Dia:
- Classes: place four Class objects and name them
Book,Member,Loan, andLibrarian. - Attributes: give
Bookthe attributesisbn: String(private),title: String(public),available: Boolean(private). GiveMembermemberId: String(private) andname: String(public). - Operations: add
borrow(member: Member): BooleantoBook, andregister(): voidtoMember. - Associations: connect
MembertoLoanwith an Association namedmakes, multiplicity1on the Member side and0..*on the Loan side. ConnectLoantoBookwith a Composition (a loan owns its line items — if the loan is deleted, they go too). - Inheritance: add a
StaffMemberclass and connect it toMemberwith Generalization (hollow triangle pointing atMember). - Interface: add an
Identifiablelollipop and connectBookandMemberto it with Realization — both can produce an ID string.
In about ten minutes you have a diagram you could put in a design document. Save it as library.dia.
Common Beginner Mistakes
- Arrows pointing the wrong way: in Generalization, the hollow triangle points at the parent (the more general class). In Dependency, the dashed arrow points at the thing being used.
- Overloading one diagram: a class diagram with 40 classes is unreadable. Split by subsystem and use Notes to cross-reference.
- Forgetting multiplicity: an association without multiplicity is ambiguous — always label both ends, even if it is just
1and*. - Modeling the database, not the domain: class diagrams show concepts and responsibilities; foreign keys belong in your ER diagram, not here.
- Floating connectors: if moving a class leaves its lines behind, you connected to the canvas (red handles). Reconnect to the green connection points.
Dia for UML: Honest Strengths and Limits
Dia is an excellent drawing tool for UML, but it is worth knowing where it stops so you pick the right tool for the job:
- Strengths: free forever, offline, fast on old hardware, correct core notation, clean SVG/PDF export. Perfect for documentation, coursework, whiteboard-style design sessions, and open-source projects.
- Limits: no model validation (Dia won’t warn you about an illegal UML construct), no XMI import/export, no code generation, no real-time collaboration. Large models (100+ classes) become hard to navigate without a model browser.
- When to upgrade: if your team needs simultaneous editing, Jira/Confluence integration, or round-trip code synchronization, that is genuinely what commercial UML tools are for. Many teams sketch in Dia and formalize in a heavier tool later — a perfectly respectable workflow.
Frequently Asked Questions
Can Dia draw UML sequence diagrams too?
Yes. The UML sheet also includes sequence-diagram objects (lifeline, call/message arrows). The workflow is the same: select the sheet, place objects, connect them. Class diagrams are the most common use, but state charts and activity diagrams are supported as well.
Is Dia good enough for professional UML work?
For documentation, teaching, and design sketching, absolutely — it covers the core UML notation correctly. What it lacks compared with commercial tools is team collaboration, model validation, and code generation. If you need real-time multi-user editing or round-trip code sync, that is the point where a paid tool earns its keep.
Can I import UML from another tool into Dia?
Dia does not import XMI (the UML interchange format), so there is no automatic conversion from tools like Enterprise Architect. You will redraw the diagram — but for most class diagrams this takes minutes, and you get a clean, editable .dia file.
How do I show generics/templates like List<T>?
In the Class properties there is a templates/parameters section where you can declare type parameters; Dia renders them in the dashed box at the top-right of the class, per UML convention.
My connectors keep detaching when I move classes. How do I fix it?
You connected to the canvas instead of the object. Delete the connector, re-select the relationship tool, and make sure you click directly on the green connection crosses of each class. Red handles mean “not attached”.
Where can I ask more Dia questions?
Check our general Dia FAQ — it covers installation, HiDPI fixes, XQuartz on Mac, and more.
